Skip to content

Conversation

@dimerman
Copy link

@dimerman dimerman commented Dec 21, 2025

Summary

Upgrades RuboCop gems to latest compatible versions for Ruby 2.7.5.

Changes

Gem Before After
rubocop 0.85.0 1.82.0
rubocop-rails 2.3.2 2.34.2
rubocop-rspec 1.39.0 3.8.0

Changelogs

Testing

  • Gemfile updated with new versions
  • bundle update executed successfully
  • .rubocop_todo.yml regenerated
  • CI checks passing (pending)

Notes

This is a major version upgrade (0.85.0 → 1.82.0) with several important breaking changes:

Configuration Parameter Renames

  • IgnoreCopDirectivesAllowCopDirectives
  • ExcludedMethodsAllowedMethods and/or AllowedPatterns
  • IgnoredPatternsAllowedPatterns
  • IgnoredMethodsAllowedMethods and/or AllowedPatterns

Extension Loading Changes

RuboCop now requires using plugins: instead of require: for extensions:

  • Old: require: rubocop-rspec
  • New: plugins: rubocop-rspec

Impact on Style Guide Configurations

The following configuration files will need updates to address obsolete parameters:

  • ruby/rubocop-ruby.yml
  • ruby/rubocop.yml
  • .rubocop.yml

Recommendations

  1. Review the .rubocop_todo.yml file for new cops that need attention
  2. Update configuration files to use new parameter names
  3. Consider updating extension loading to use plugins: syntax
  4. Test the thanx-style gem in dependent projects before releasing

Summary by CodeRabbit

  • Chores
    • Updated RuboCop development dependencies with pinned version constraints to ensure consistent and reproducible builds across all development environments.
    • Refined code quality configuration with new linting rule overrides and specific file exclusions for improved control over code style compliance checks.

✏️ Tip: You can customize this high-level summary in your review settings.

Upgrade RuboCop gems to latest compatible versions for Ruby 2.7.5:
- rubocop: 0.85.0 → 1.82.0
- rubocop-rails: 2.3.2 → 2.34.2
- rubocop-rspec: 1.39.0 → 3.8.0

Regenerated .rubocop_todo.yml to capture new cops and violations.

Note: This is a major version upgrade with several breaking changes:
- Configuration parameters renamed (IgnoreCopDirectives → AllowCopDirectives, etc.)
- Extension loading changed from 'require:' to 'plugins:' syntax
- Many new cops and stricter checking introduced

Changelogs:
- https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
- https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md
- https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md
@dimerman dimerman self-assigned this Dec 21, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 21, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Introduces RuboCop linting configuration by updating .rubocop.yml to inherit from a new auto-generated .rubocop_todo.yml file that catalogs known code violations, while pinning RuboCop gem versions in the Gemfile with ~> constraints.

Changes

Cohort / File(s) Summary
RuboCop Configuration
\.rubocop\.yml
Added .rubocop_todo.yml to inherit_from array to load auto-generated offense exclusions
RuboCop Todo File
\.rubocop_todo\.yml
New auto-generated file documenting excluded offense rules for Gemspec/RequiredRubyVersion and Style/HashEachMethods with specific file exclusions
Gem Dependency Versioning
Gemfile
Pinned rubocop, rubocop-rails, and rubocop-rspec gems with pessimistic version constraints (~> x.y.z)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify .rubocop_todo.yml is properly auto-generated and contains valid RuboCop syntax
  • Confirm inherit_from path in .rubocop.yml resolves correctly and maintains expected precedence
  • Check that pinned gem versions in Gemfile are compatible with each other and the project's Ruby version

Poem

🐰✨ A rabbit hops through code so fine,
With rubocop rules in perfect line,
Style and syntax, now kept in check,
Todo's tidy—no style wreck!
Gems are pinned, the gems behave,
Clean code hopping, neat and brave! 🌿

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Upgrade RuboCop gems' directly and clearly summarizes the main change—updating RuboCop-related gems to newer versions with compatibility improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.rubocop_todo.yml (1)

9-12: Prioritize addressing the Gemspec/RequiredRubyVersion offense.

The Gemspec/RequiredRubyVersion cop ensures the gemspec declares minimum Ruby version requirements, which is important for compatibility. Since this PR targets Ruby 2.7.5 compatibility, consider addressing this offense early rather than deferring it.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfe94d8 and 94669d5.

⛔ Files ignored due to path filters (1)
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • .rubocop.yml (1 hunks)
  • .rubocop_todo.yml (1 hunks)
  • Gemfile (1 hunks)
🔇 Additional comments (3)
.rubocop_todo.yml (1)

14-20: Style violations can be addressed incrementally.

The Style/HashEachMethods exclusions are reasonable to defer. These are style improvements that can be tackled separately without impacting functionality.

.rubocop.yml (1)

2-2: Todo file inheritance correctly configured.

Adding .rubocop_todo.yml before ruby/rubocop.yml ensures exclusions are properly applied. The inheritance order is correct.

Gemfile (1)

10-12: Gem versions are valid and have no known security vulnerabilities.

rubocop 1.82.0 was released December 17, 2025, rubocop-rails 2.34.2 was released November 29, 2025, and rubocop-rspec 3.8.0 was released November 12, 2025. All specified versions exist and are publicly available. The version constraints using ~> are appropriately pessimistic, allowing only patch-level updates while protecting against incompatible minor and major version changes.

Comment on lines 1 to 3
inherit_from:
- .rubocop_todo.yml
- ruby/rubocop.yml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check RuboCop configuration files for deprecated parameters and extension loading syntax

echo "=== Checking for deprecated configuration parameters ==="
echo -e "\nSearching for deprecated parameter names..."
rg -n --type=yaml '(IgnoreCopDirectives|ExcludedMethods|IgnoredPatterns|IgnoredMethods):' \
  .rubocop.yml ruby/rubocop.yml ruby/rubocop-ruby.yml 2>/dev/null || echo "No deprecated parameters found"

echo -e "\n=== Checking extension loading syntax ==="
echo -e "\nSearching for 'require:' (should be 'plugins:' in RuboCop 1.x)..."
rg -n --type=yaml '^require:' .rubocop.yml ruby/rubocop.yml ruby/rubocop-ruby.yml 2>/dev/null || echo "No 'require:' found"

echo -e "\nSearching for 'plugins:' (correct for RuboCop 1.x)..."
rg -n --type=yaml '^plugins:' .rubocop.yml ruby/rubocop.yml ruby/rubocop-ruby.yml 2>/dev/null || echo "No 'plugins:' found"

echo -e "\n=== Checking if ruby/rubocop-ruby.yml and ruby/rubocop.yml exist ==="
fd --type=f '^rubocop.*\.yml$' ruby/

Repository: thanx/style-guide

Length of output: 723


Apply required RuboCop configuration changes before merge.

The PR has not applied the mandatory breaking changes needed for the major RuboCop upgrade:

In ruby/rubocop-ruby.yml:

  • Line 144: IgnoreCopDirectivesAllowCopDirectives
  • Line 148: IgnoredPatternsAllowedPatterns
  • Line 276: IgnoredMethodsAllowedMethods
  • Line 425: ExcludedMethodsAllowedMethods

In ruby/rubocop.yml:

  • Line 22: require:plugins:

These parameter renames and syntax changes are required for RuboCop 1.x compatibility and will cause failures if left unchanged.

🤖 Prompt for AI Agents
In .rubocop.yml around lines 1-3 and in the referenced ruby config files, the
RuboCop 1.x breaking changes were not applied; update ruby/rubocop.yml to
replace the top-level `require:` key with `plugins:`, and update
ruby/rubocop-ruby.yml to rename the listed parameters: change
`IgnoreCopDirectives` to `AllowCopDirectives` at ~line 144, `IgnoredPatterns` to
`AllowedPatterns` at ~line 148, `IgnoredMethods` to `AllowedMethods` at ~line
276, and `ExcludedMethods` to `AllowedMethods` at ~line 425; make these exact
key renames (preserving values/formatting) and run RuboCop to verify no
remaining compatibility errors before merging.

@dimerman dimerman marked this pull request as draft December 21, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants