diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..46a60de --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,24 @@ +version: 2 +updates: + - package-ecosystem: bundler + directory: "/" + schedule: + interval: weekly + groups: + all-dependencies: + patterns: + - "*" + update-types: + - "minor" + - "patch" + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + groups: + all-dependencies: + patterns: + - "*" + update-types: + - "minor" + - "patch" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3963d08..9cf85a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,10 @@ on: - main pull_request: +permissions: + contents: write + pull-requests: write + jobs: build: runs-on: ubuntu-latest @@ -13,12 +17,12 @@ jobs: strategy: matrix: ruby: - - '2.7' + - '3.2' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@2a7b30092b0caf9c046252510f9273b4875f3db9 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true diff --git a/.rubocop.yml b/.rubocop.yml index 8cbb45e..503ac56 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ +require: + - rubocop-rails-accessibility + inherit_gem: rubocop-github: - config/default.yml @@ -7,3 +10,4 @@ Naming/FileName: Enabled: true Exclude: - "rubocop-rails-accessibility.gemspec" + - "lib/rubocop-rails-accessibility.rb" diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..fd16fce --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @github/accessibility-reviewers diff --git a/Gemfile.lock b/Gemfile.lock index ecc1cb7..09c70c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,97 +1,132 @@ PATH remote: . specs: - rubocop-rails-accessibility (0.1.0) + rubocop-rails-accessibility (1.0.1) rubocop (>= 1.0.0) GEM remote: https://rubygems.org/ specs: - actionview (7.0.3.1) - activesupport (= 7.0.3.1) + actionview (8.0.2) + activesupport (= 8.0.2) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activesupport (7.0.3.1) - concurrent-ruby (~> 1.0, >= 1.0.2) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activesupport (8.0.2) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - ast (2.4.2) - builder (3.2.4) - concurrent-ruby (1.1.10) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + ast (2.4.3) + base64 (0.3.0) + benchmark (0.4.1) + bigdecimal (3.2.2) + builder (3.3.0) + concurrent-ruby (1.3.5) + connection_pool (2.5.3) crass (1.0.6) - diff-lcs (1.5.0) - erubi (1.11.0) - i18n (1.12.0) + diff-lcs (1.6.2) + drb (2.2.3) + erubi (1.13.1) + i18n (1.14.7) concurrent-ruby (~> 1.0) - json (2.6.2) - loofah (2.18.0) + json (2.13.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + logger (1.7.0) + loofah (2.24.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - minitest (5.16.3) - nokogiri (1.13.8-x86_64-darwin) + nokogiri (>= 1.12.0) + minitest (5.25.5) + nokogiri (1.18.9-arm64-darwin) racc (~> 1.4) - nokogiri (1.13.8-x86_64-linux) + nokogiri (1.18.9-x86_64-darwin) racc (~> 1.4) - parallel (1.22.1) - parser (3.1.2.0) + nokogiri (1.18.9-x86_64-linux-gnu) + racc (~> 1.4) + parallel (1.27.0) + parser (3.3.9.0) ast (~> 2.4.1) - racc (1.6.0) - rack (2.2.4) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + racc + prism (1.4.0) + racc (1.8.1) + rack (3.1.16) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rainbow (3.1.1) - rake (13.0.6) - regexp_parser (2.5.0) - rexml (3.2.5) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rake (13.3.0) + regexp_parser (2.10.0) + rspec (3.13.1) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.4) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-support (3.11.0) - rubocop (1.31.2) + rspec-support (~> 3.13.0) + rspec-support (3.13.4) + rubocop (1.79.0) json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.18.0, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.46.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.19.1) - parser (>= 3.1.1.0) - rubocop-github (0.18.0) - rubocop (>= 1.0.0) - rubocop-performance - rubocop-rails - rubocop-performance (1.14.3) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.15.2) + tsort (>= 0.2.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.46.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-github (0.26.0) + rubocop (>= 1.76) + rubocop-performance (>= 1.24) + rubocop-rails (>= 2.23) + rubocop-performance (1.25.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rails (2.32.0) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) - ruby-progressbar (1.11.0) - tzinfo (2.0.5) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + ruby-progressbar (1.13.0) + securerandom (0.4.1) + tsort (0.2.0) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.2.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + uri (1.0.3) PLATFORMS + arm64-darwin-21 + arm64-darwin-23 x86_64-darwin-19 + x86_64-darwin-21 x86_64-linux DEPENDENCIES @@ -105,4 +140,4 @@ DEPENDENCIES rubocop-rails-accessibility! BUNDLED WITH - 2.3.17 + 2.4.10 diff --git a/README.md b/README.md index f3cc2b8..495297b 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,8 @@ You need to tell RuboCop to load RuboCop Rails Accessibility. Put this into your `.rubocop.yml`. ``` yaml -inherit_gem: - rubocop-rails-accessibility: - - config/default.yml - - config/rubocop_rails_accessibility.yml +require: + - rubocop-rails-accessibility ``` ## Testing @@ -48,15 +46,14 @@ bundle exec rake ## The Cops All cops are located under -[`lib/rubocop/cop/rubocop_rails_accessibility`](lib/rubocop/cop/rubocop_rails_accessibility), and contain +[`lib/rubocop/cop/rails_accessibility`](lib/rubocop/cop/rails_accessibility), and contain examples/documentation. ## Rules -- [RuboCop::Cop::Accessibility::ImageHasAlt](guides/image-has-alt.md) -- [RuboCop::Cop::Accessibility::LinkHasHref](guides/link-has-href.md) -- [RuboCop::Cop::Accessibility::NoPositiveTabindex](guides/no-positive-tabindex.md) -- [RuboCop::Cop::Accessibility::NoRedundantImageAlt](guides/no-redundant-image-alt.md) +- [RailsAccessibility/ImageHasAlt](guides/image-has-alt.md) +- [RailsAccessibility/NoPositiveTabindex](guides/no-positive-tabindex.md) +- [RailsAccessibility/NoRedundantImageAlt](guides/no-redundant-image-alt.md) ## Contributing diff --git a/config/default.yml b/config/default.yml index c5cbbd3..5d6cc8f 100644 --- a/config/default.yml +++ b/config/default.yml @@ -1,18 +1,11 @@ -require: - - rubocop/cop/rubocop_rails_accessibility_cops - -AllCops: - DisabledByDefault: true - -RubocopRailsAccessibility/ImageHasAlt: +RailsAccessibility/ImageHasAlt: Enabled: true StyleGuide: https://github.com/github/rubocop-rails-accessibility/blob/master/guides/image-has-alt.md -RubocopRailsAccessibility/LinkHasHref: - Enabled: true - StyleGuide: https://github.com/github/rubocop-rails-accessibility/blob/master/guides/link-has-href.md -RubocopRailsAccessibility/NoPositiveTabindex: + +RailsAccessibility/NoPositiveTabindex: Enabled: true StyleGuide: https://github.com/github/rubocop-rails-accessibility/blob/master/guides/no-positive-tabindex.md -RubocopRailsAccessibility/NoRedundantImageAlt: + +RailsAccessibility/NoRedundantImageAlt: Enabled: true StyleGuide: https://github.com/github/rubocop-rails-accessibility/blob/master/guides/no-redundant-image-alt.md diff --git a/guides/image-has-alt.md b/guides/image-has-alt.md index 3dab40b..0ee9466 100644 --- a/guides/image-has-alt.md +++ b/guides/image-has-alt.md @@ -1,4 +1,4 @@ -# RubocopRailsAccessibility/ImageHasAlt +# RailsAccessibility/ImageHasAlt ## Rule Details @@ -26,4 +26,4 @@ Images should have an alt prop with meaningful text or an empty string for decor ```erb <%= image_tag "spinners/octocat-spinner-16px.gif", size: "12x12", alt: "" %> -``` \ No newline at end of file +``` diff --git a/guides/link-has-href.md b/guides/link-has-href.md deleted file mode 100644 index 9ace0e3..0000000 --- a/guides/link-has-href.md +++ /dev/null @@ -1,29 +0,0 @@ -# RubocopRailsAccessibility/LinkHasHref - -## Rule Details - -Links should go somewhere, you probably want to use a `