diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ae421c7..86059b7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: - name: checkout uses: actions/checkout@v4 - - uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # pin@v1.221.0 + - uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # pin@v1.244.0 with: bundler-cache: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1df707db..24ca871b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: - name: checkout uses: actions/checkout@v4 - - uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # pin@v1.221.0 + - uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # pin@v1.244.0 with: bundler-cache: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 89ccb6c1..84778eda 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: - name: checkout uses: actions/checkout@v4 - - uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # pin@v1.221.0 + - uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # pin@v1.244.0 with: bundler-cache: true @@ -39,7 +39,7 @@ jobs: - name: build run: echo "GEM_VERSION=$(gem build ${{ env.GEM_NAME }}.gemspec 2>&1 | grep Version | cut -d':' -f 2 | tr -d " \t\n\r")" >> $GITHUB_ENV - - uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # pin@v2 + - uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # pin@v2 with: subject-path: "${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aebd3962..af449019 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - name: Update .ruby-version with matrix value run: echo "${{ matrix.ruby_version }}" >| .ruby-version - - uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # pin@v1.221.0 + - uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # pin@v1.244.0 with: bundler-cache: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 2496c68f..f89036a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # rubocop-github +## v0.25.0 + +- Read the automatic release notes on [the /releases page for this gem](https://github.com/github/rubocop-github/releases). +- Updated related gems +- Specify plugin class names for included rubocop plugins + +## v0.24.0 + +- Read the automatic release notes on [the /releases page for this gem](https://github.com/github/rubocop-github/releases). + ## v0.23.0 - Read the automatic release notes on [the /releases page for this gem](https://github.com/github/rubocop-github/releases). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 72cf0a2c..e5ef656b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,6 +51,6 @@ Rubocop regularly releases new versions with new cops. We want to keep up to dat 1. Update [`lib/version.rb`](lib/version.rb) with the next version number 2. Update the `CHANGELOG` with changes and contributor -3. Run `bundle` to update gem version contained in the lockfile +3. Run `bundle install` to update gem version contained in the lockfile 4. Commit your changes and open a pull request 5. When the pull request is approved and merged into `main`, the [`.github/workflows/release.yml`](.github/workflows/release.yml) workflow will automatically run to release the new version to RubyGems and GitHub Packages 🎉. diff --git a/Gemfile.lock b/Gemfile.lock index 8c60f672..d4d29779 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rubocop-github (0.23.0) + rubocop-github (0.25.0) rubocop (>= 1.72) rubocop-performance (>= 1.24) rubocop-rails (>= 2.23) @@ -9,62 +9,61 @@ PATH GEM remote: https://rubygems.org/ specs: - actionview (7.1.5.1) - activesupport (= 7.1.5.1) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activesupport (7.1.5.1) + activesupport (7.2.2.1) base64 benchmark (>= 0.3) bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) logger (>= 1.4.2) minitest (>= 5.1) - mutex_m securerandom (>= 0.3) - tzinfo (~> 2.0) - ast (2.4.2) + tzinfo (~> 2.0, >= 2.0.5) + ast (2.4.3) base64 (0.2.0) benchmark (0.4.0) bigdecimal (3.1.9) builder (3.3.0) concurrent-ruby (1.3.5) - connection_pool (2.5.0) + connection_pool (2.5.3) crass (1.0.6) - drb (2.2.1) + drb (2.2.3) erubi (1.13.1) i18n (1.14.7) concurrent-ruby (~> 1.0) - json (2.10.1) - language_server-protocol (3.17.0.4) + json (2.12.2) + language_server-protocol (3.17.0.5) lint_roller (1.1.0) - logger (1.6.6) + logger (1.7.0) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mini_portile2 (2.8.8) - minitest (5.25.4) - mutex_m (0.3.0) - nokogiri (1.18.3) + minitest (5.25.5) + nokogiri (1.18.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.3-arm64-darwin) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.3-x86_64-darwin) + nokogiri (1.18.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.3-x86_64-linux-gnu) + nokogiri (1.18.8-x86_64-linux-gnu) racc (~> 1.4) - parallel (1.26.3) - parser (3.3.7.1) + parallel (1.27.0) + parser (3.3.8.0) ast (~> 2.4.1) racc + prism (1.4.0) racc (1.8.1) - rack (3.1.10) + rack (3.1.15) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -75,7 +74,7 @@ GEM rainbow (3.1.1) rake (13.2.1) regexp_parser (2.10.0) - rubocop (1.73.0) + rubocop (1.75.7) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -83,21 +82,22 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.38.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.38.1) - parser (>= 3.3.1.0) - rubocop-performance (1.24.0) + rubocop-ast (1.44.1) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-performance (1.25.0) lint_roller (~> 1.1) - rubocop (>= 1.72.1, < 2.0) + rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.38.0, < 2.0) - rubocop-rails (2.30.2) + rubocop-rails (2.32.0) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.72.1, < 2.0) - rubocop-ast (>= 1.38.0, < 2.0) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (1.13.0) securerandom (0.4.1) tzinfo (2.0.6) @@ -114,7 +114,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - actionview (~> 7.1.5.1) + actionview (~> 7.2.2.1) minitest rake rubocop-github! diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md index 6cb942d1..31f33664 100644 --- a/STYLEGUIDE.md +++ b/STYLEGUIDE.md @@ -3,6 +3,7 @@ This is GitHub's Ruby Style Guide, inspired by [RuboCop's guide][rubocop-guide]. ## Table of Contents + 1. [Layout](#layout) 1. [Indentation](#indentation) 2. [Inline](#inline) @@ -763,6 +764,22 @@ if x > 10 end ``` +* Don't use `unless` with a negated condition. + [[link](#no-unless-negation)] + * RuboCop rule: Style/NegatedUnless + +```ruby +# bad +unless !condition? + do_something +end + +# good +if condition? + do_something +end +``` + ### Ternary operator * Avoid the ternary operator (`?:`) except in cases where all expressions are extremely diff --git a/config/default.yml b/config/default.yml index cf5d193e..ff7eec81 100644 --- a/config/default.yml +++ b/config/default.yml @@ -5,7 +5,8 @@ require: - rubocop-github plugins: - - rubocop-performance + - rubocop-performance: + plugin_class_name: RuboCop::Performance::Plugin Bundler/DuplicatedGem: Enabled: true @@ -1370,7 +1371,7 @@ Style/NegatedIfElseCondition: Enabled: false Style/NegatedUnless: - Enabled: false + Enabled: true Style/NegatedWhile: Enabled: false diff --git a/config/rails.yml b/config/rails.yml index 80458562..cba38c11 100644 --- a/config/rails.yml +++ b/config/rails.yml @@ -5,7 +5,8 @@ require: - rubocop-github-rails plugins: - - rubocop-rails + - rubocop-rails: + plugin_class_name: RuboCop::Rails::Plugin GitHub/RailsControllerRenderActionSymbol: Enabled: true diff --git a/lib/rubocop/cop/github/rails_view_render_literal.rb b/lib/rubocop/cop/github/rails_view_render_literal.rb index c8563868..357b2ee1 100644 --- a/lib/rubocop/cop/github/rails_view_render_literal.rb +++ b/lib/rubocop/cop/github/rails_view_render_literal.rb @@ -54,7 +54,7 @@ def on_send(node) if render_literal?(node) && node.arguments.count > 1 locals = node.arguments[1] - elsif options_pairs = render_with_options?(node) + elsif option_pairs = render_with_options?(node) locals = option_pairs.map { |pair| locals_key?(pair) }.compact.first end diff --git a/lib/version.rb b/lib/version.rb index fd3043d4..a9f2b951 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -VERSION = "0.23.0" +VERSION = "0.25.0" diff --git a/rubocop-github.gemspec b/rubocop-github.gemspec index 18b5aff9..43cb7e3d 100644 --- a/rubocop-github.gemspec +++ b/rubocop-github.gemspec @@ -18,13 +18,13 @@ Gem::Specification.new do |s| s.files = Dir["README.md", "STYLEGUIDE.md", "LICENSE", "config/*.yml", "lib/**/*.rb", "guides/*.md"] - s.required_ruby_version = ">= 3.0.0" + s.required_ruby_version = ">= 3.1.0" s.add_dependency "rubocop", ">= 1.72" s.add_dependency "rubocop-performance", ">= 1.24" s.add_dependency "rubocop-rails", ">= 2.23" - s.add_development_dependency "actionview", "~> 7.1.5.1" + s.add_development_dependency "actionview", "~> 7.2.2.1" s.add_development_dependency "minitest" s.add_development_dependency "rake"