Skip to content

LintRoller plugin, rather than Inject monkey-patch#160

Merged
AlfonsoUceda merged 3 commits intomasterfrom
pf-rubocop-pluginfy
Mar 30, 2026
Merged

LintRoller plugin, rather than Inject monkey-patch#160
AlfonsoUceda merged 3 commits intomasterfrom
pf-rubocop-pluginfy

Conversation

@AlfonsoUceda
Copy link
Copy Markdown
Contributor

@AlfonsoUceda AlfonsoUceda commented Mar 30, 2026

RuboCop 1.72+ introduced a formal plugin system via LintRoller::Plugin, replacing the need to monkey-patch ConfigLoader to inject default configuration. This PR migrates rubocop-granite from the legacy Inject.defaults! pattern to the new plugin API, following the approach taken by rubocop-toptal#53.

  • Inject module removed, replaced by RuboCop::Granite::Plugin class
  • Minimum rubocop bumped to >= 1.72.1, lint_roller ~> 1.1 added
  • default_lint_roller_plugin gemspec metadata registered
  • README updated to use plugins: instead of require:

Users should use plugins: rubocop-granite in their .rubocop.yml instead of require: rubocop-granite.

Review

Pre-merge checklist

  • The PR relates to a single subject with a clear title and description in grammatically correct, complete sentences.
  • Verify that feature branch is up-to-date with master (if not - rebase it).
  • Double check the quality of commit messages.
  • Squash related commits together.

@AlfonsoUceda AlfonsoUceda changed the title Pf rubocop pluginfy LintRoller plugin, rather than Inject monkey-patch Mar 30, 2026
RuboCop 1.72+ supports a formal plugin system via LintRoller::Plugin.
This replaces the old Inject.defaults! approach that monkey-patched
ConfigLoader with a proper Plugin class that declares its config
through the LintRoller API.

- Add lib/rubocop/granite/plugin.rb
- Remove lib/rubocop/granite/inject.rb
- Bump minimum rubocop to >= 1.72.1
- Add lint_roller ~> 1.1 dependency
- Add default_lint_roller_plugin gemspec metadata
- Update README to use plugins: instead of require:
Copy link
Copy Markdown
Member

@bbatsov bbatsov left a comment

Choose a reason for hiding this comment

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

Well done!

@AlfonsoUceda AlfonsoUceda merged commit d26a5b9 into master Mar 30, 2026
7 checks passed
@AlfonsoUceda AlfonsoUceda deleted the pf-rubocop-pluginfy branch March 30, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants