diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ae421c7..8ba68a68 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@472790540115ce5bd69d399a020189a8c87d641f # pin@v1.247.0 with: bundler-cache: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1df707db..b1584d39 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@472790540115ce5bd69d399a020189a8c87d641f # pin@v1.247.0 with: bundler-cache: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 513782d2..d5ba6bf0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,8 @@ on: permissions: contents: write packages: write + id-token: write + attestations: write jobs: release: @@ -20,7 +22,7 @@ jobs: - name: checkout uses: actions/checkout@v4 - - uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # pin@v1.221.0 + - uses: ruby/setup-ruby@472790540115ce5bd69d399a020189a8c87d641f # pin@v1.247.0 with: bundler-cache: true @@ -37,13 +39,17 @@ 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@e8998f949152b193b063cb0ec769d69d929409be # pin@v2 + with: + subject-path: "${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem" + - name: publish to GitHub packages run: | export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 ) GEM_HOST_API_KEY=${{ secrets.GITHUB_TOKEN }} gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} ${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem - name: release - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # pin@v1.14.0 + uses: ncipollo/release-action@bcfe5470707e8832e12347755757cec0eb3c22af # pin@v1.18.0 with: artifacts: "${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem" tag: "v${{ env.GEM_VERSION }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a95733d..981c487f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - ruby_version: ["3.0", "3.1", "3.2", "3.3"] + ruby_version: ["3.1", "3.2", "3.3", "3.4"] steps: - uses: actions/checkout@v4 @@ -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@472790540115ce5bd69d399a020189a8c87d641f # pin@v1.247.0 with: bundler-cache: true diff --git a/.gitignore b/.gitignore index 35b4f5bf..25f6e982 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ test/tmp test/version_tmp tmp bin/ +vendor/ # YARD artifacts .yardoc diff --git a/.ruby-version b/.ruby-version index e4604e3a..4d9d11cf 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.1 +3.4.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index bf2db2f4..f9ed0a51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # rubocop-github +## v0.26.0 + +- Read the automatic release notes on [the /releases page for this gem](https://github.com/github/rubocop-github/releases). + +## 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). + ## v0.22.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 46639226..2a3020e1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,70 +1,69 @@ PATH remote: . specs: - rubocop-github (0.22.0) - rubocop (>= 1.37) - rubocop-performance (>= 1.15) - rubocop-rails (>= 2.17) + rubocop-github (0.26.0) + rubocop (>= 1.76) + rubocop-performance (>= 1.24) + rubocop-rails (>= 2.23) 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) - erubi (1.13.0) + 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) - loofah (2.23.1) + 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.17.2) + minitest (5.25.5) + nokogiri (1.18.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.17.2-arm64-darwin) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.17.2-x86_64-darwin) + nokogiri (1.18.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.17.2-x86_64-linux) + 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.16) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -73,9 +72,9 @@ GEM 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.2.1) + rake (13.3.0) regexp_parser (2.10.0) - rubocop (1.72.2) + rubocop (1.78.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -83,23 +82,24 @@ 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.45.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.38.0) - parser (>= 3.3.1.0) - rubocop-performance (1.24.0) + rubocop-ast (1.45.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.1) + 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.3.2) + securerandom (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (3.1.4) @@ -114,10 +114,10 @@ PLATFORMS x86_64-linux DEPENDENCIES - actionview + actionview (~> 7.2.2.1) minitest rake rubocop-github! BUNDLED WITH - 2.4.9 + 2.6.5 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 52d44625..55fb0aff 100644 --- a/config/default.yml +++ b/config/default.yml @@ -3,7 +3,10 @@ inherit_from: require: - rubocop-github - - rubocop-performance + +plugins: + - rubocop-performance: + plugin_class_name: RuboCop::Performance::Plugin Bundler/DuplicatedGem: Enabled: true @@ -815,7 +818,7 @@ Naming/MethodName: Naming/MethodParameterName: Enabled: false -Naming/PredicateName: +Naming/PredicatePrefix: Enabled: false Naming/RescuedExceptionsVariableName: @@ -1368,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 b7b8d6ec..cba38c11 100644 --- a/config/rails.yml +++ b/config/rails.yml @@ -3,7 +3,10 @@ inherit_from: require: - rubocop-github-rails - - rubocop-rails + +plugins: + - 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 3ed48bc6..8463eaf1 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -VERSION = "0.22.0" +VERSION = "0.26.0" diff --git a/rubocop-github.gemspec b/rubocop-github.gemspec index a7f53d19..b1cf9cc4 100644 --- a/rubocop-github.gemspec +++ b/rubocop-github.gemspec @@ -18,16 +18,16 @@ Gem::Specification.new do |s| s.files = Dir["README.md", "STYLEGUIDE.md", "LICENSE", "config/*.yml", "lib/**/*.rb", "guides/*.md"] - s.add_dependency "rubocop", ">= 1.37" - s.add_dependency "rubocop-performance", ">= 1.15" - s.add_dependency "rubocop-rails", ">= 2.17" + s.required_ruby_version = ">= 3.1.0" - s.add_development_dependency "actionview" + s.add_dependency "rubocop", ">= 1.76" + s.add_dependency "rubocop-performance", ">= 1.24" + s.add_dependency "rubocop-rails", ">= 2.23" + + s.add_development_dependency "actionview", "~> 7.2.2.1" s.add_development_dependency "minitest" s.add_development_dependency "rake" - s.required_ruby_version = ">= 3.0.0" - s.email = "engineering@github.com" s.authors = "GitHub" end
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: