Bump rubocop, fix violations, add Ruby matrix#215
Conversation
Drops the ~> 0.50.0 (2017) pin and the band-aids it required: `TargetRubyVersion: 2.4` and the Ruby 2.7 workflow pin (the latter removed in a follow-up commit). `Metrics/LineLength` is renamed to `Layout/LineLength` (cop moved namespace in rubocop 0.79). `NewCops: disable` keeps the surface stable; flipping it on can be a follow-up. This commit knowingly leaves the linter red — violations are addressed in the next commit. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mostly autocorrected: trailing whitespace, indentation, block-brace spacing, redundant regex escapes, gem ordering, frozen-string magic comments, etc. `rubocop -a` followed by manual config tweaks to clear what can't be mechanically fixed without changing public API: - `Metrics/ClassLength` raised to 250 (DangerSwiftlint is 213 lines). - `Metrics/MethodLength` raised to 15 (`Swiftlint#run` is 14). - `Metrics/ParameterLists` excluded for `Swiftlint#run` — the positional/keyword signature is the plugin's public contract. - `Metrics/PerceivedComplexity` adds `swiftlint.rb` to existing exclude. - `Lint/ConstantDefinitionInBlock` excluded for the rake task — intentional rake idiom. - `Gemspec/RequiredRubyVersion` disabled; the gemspec's minimum is a downstream-compatibility statement, not a lint target. - `spec/.rubocop.yml` migrated from `Metrics/LineLength` to `Layout/LineLength` (the namespace move that bit the parent config). Specs continue to pass (57 examples, 0 failures). --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`spec` now runs across Ruby 3.0–3.4. `rubocop` no longer needs the Ruby 2.7 pin or the matching FIXME now that the gem is on a modern release. `parallel` is pinned to `< 2` in the Gemfile: parallel 2.x requires Ruby >= 3.3, which would break matrix entries for 3.0–3.2. The pin is dev-only and doesn't affect downstream consumers. Smoke-tested locally on Ruby 3.2.2 and 3.3.7; both pass. 3.0 and 3.1 are exercised on CI. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| rubocop: | ||
| name: RuboCop | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '2.7' | ||
| bundler-cache: true | ||
| - run: bundle exec rubocop |
There was a problem hiding this comment.
Doesn't seem worth to run RuboCop on a matrix as it's less important than test coverage, as the latter could discover genuine compatibility issues. But, it should be relatively cheap to add a matrix here too.
There was a problem hiding this comment.
I agree this is the right tradeoff 👍
| # `parallel` 2.x requires Ruby >= 3.3 — keep it on 1.x so the matrix | ||
| # can still install on Ruby 3.0–3.2. | ||
| gem 'parallel', '< 2' |
There was a problem hiding this comment.
I'd be fine with dropping those versions. The only devs who would face an issue would be devs updating their CI, so, they'd be keeping up to date with Ruby too. (Or at least, I hope so!)
There was a problem hiding this comment.
Pull request overview
Modernizes the project’s Ruby tooling by upgrading RuboCop, applying the resulting formatting/lint fixes, and expanding CI to run the RSpec suite across multiple Ruby 3.x versions.
Changes:
- Upgrade RuboCop to a modern release and update RuboCop configuration (including new cop namespaces/settings).
- Apply RuboCop-driven code/spec formatting fixes and small refactors.
- Update GitHub Actions to run RSpec on a Ruby 3.0–3.4 matrix and remove the RuboCop Ruby 2.7 pin.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| spec/swiftlint_spec.rb | Spec require/path and formatting adjustments to satisfy newer RuboCop rules. |
| spec/spec_helper.rb | Updates ROOT resolution and load path setup (currently introduces a broken $LOAD_PATH entry). |
| spec/danger_plugin_spec.rb | Spec formatting/whitespace and block style fixes. |
| spec/.rubocop.yml | Updates deprecated cop namespace (Metrics/LineLength → Layout/LineLength). |
| lib/danger_plugin.rb | Formatting refactors and minor code cleanups to satisfy RuboCop. |
| Gemfile | Bumps RuboCop constraint and adds dev dependency constraints for Ruby matrix compatibility. |
| Gemfile.lock | Locks updated RuboCop and transitive dependencies. |
| ext/swiftlint/swiftlint.rb | Minor style cleanups (method parens, early return) per RuboCop. |
| ext/swiftlint/Rakefile | Freezes a URL constant to satisfy frozen string / style rules. |
| danger-swiftlint.gemspec | Modernizes path expansion and reorders dependencies. |
| bin/danger-swiftlint | Simplifies load path setup using __dir__. |
| .rubocop.yml | Updates RuboCop baseline config for Ruby 3.0+ and adds targeted exclusions. |
| .github/workflows/ci.yml | Adds Ruby matrix to RSpec job and removes RuboCop’s Ruby 2.7 pin. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ashfurrow
left a comment
There was a problem hiding this comment.
Looks good to me! Left some notes. We can redirect to the main branch and merge when you see fit.
Thanks again for this. It was good to see you around GitHub!
| rubocop: | ||
| name: RuboCop | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '2.7' | ||
| bundler-cache: true | ||
| - run: bundle exec rubocop |
There was a problem hiding this comment.
I agree this is the right tradeoff 👍
| # `parallel` 2.x requires Ruby >= 3.3 — keep it on 1.x so the matrix | ||
| # can still install on Ruby 3.0–3.2. | ||
| gem 'parallel', '< 2' |
There was a problem hiding this comment.
I'd be fine with dropping those versions. The only devs who would face an issue would be devs updating their CI, so, they'd be keeping up to date with Ruby too. (Or at least, I hope so!)
Likewise! I subscribe to this repo and it was nice to see the notification pop up for #213. Hope everything is well. |
Follow up to ashfurrow#215 (comment), which highlighted Ruby versions < 3.3 are no longer receiving support.

Builds on top of #214 to implement "noisy" changes: