Fix extend_config support for lint_roller-based RuboCop plugins#728
Open
HolyGrail wants to merge 1 commit intostandardrb:mainfrom
Open
Fix extend_config support for lint_roller-based RuboCop plugins#728HolyGrail wants to merge 1 commit intostandardrb:mainfrom
HolyGrail wants to merge 1 commit intostandardrb:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
RuboCop plugins migrated to lint_roller, but
extend_configdoesn't process theplugins:directive to load and register plugins dynamically.Resolves #701 and #715.
Solution
Automatically detect and integrate lint_roller plugins when:
plugins: [rubocop-xxx]in.standard.ymlplugins:section and cop configurations in extended filesThis preserves backward compatibility while enabling dynamic plugin loading through
extend_config.Technical Approach
default_lint_roller_pluginmetadataplugins:(not deprecatedrequire:)Implementation Details
DetectsLintRollerPluginsto discover lint_roller plugins from loaded gemsMergesUserConfigExtensionswith conditional detection logicpermit_mergingfor proper cop configuration mergingTesting
Verified with demo repository that reproduces the original issues:
https://github.com/andyw8/demo-standard-rubocop-minitest
Before:
After:
Author's Note
This pull request was created with AI assistance to resolve the reported issues. I apologize if extending
extend_configfunctionality doesn't align with the project's philosophy.I use the standard gem as part of my work at my company, and I hope this project will continue to actively address such issues and keep pace with frequent RuboCop gem updates. I'd be happy if this contribution helps in some way.
Thank you.