Skip to content

Conversation

@HolyGrail
Copy link

Problem

RuboCop plugins migrated to lint_roller, but extend_config doesn't process the plugins: directive to load and register plugins dynamically.

Resolves #701 and #715.

Solution

Automatically detect and integrate lint_roller plugins when:

  1. Main config declares plugins - plugins: [rubocop-xxx] in .standard.yml
  2. extend_config contains plugins + namespaced cops - Both plugins: section and cop configurations in extended files

This preserves backward compatibility while enabling dynamic plugin loading through extend_config.

Technical Approach

  • Plugin detection: Scan gems for default_lint_roller_plugin metadata
  • Conditional activation: Only when explicit plugin usage detected
  • Aligns with RuboCop direction: Supports plugins: (not deprecated require:)

Implementation Details

  • Added DetectsLintRollerPlugins to discover lint_roller plugins from loaded gems
  • Enhanced MergesUserConfigExtensions with conditional detection logic
  • Uses permit_merging for proper cop configuration merging
  • Maintains first-in-wins semantics for configuration precedence

Testing

Verified with demo repository that reproduces the original issues:
https://github.com/andyw8/demo-standard-rubocop-minitest

Before:

$ standardrb test/example_test.rb
# No output (offense not detected)

After:

$ standardrb test/example_test.rb
standard: Use Ruby Standard Style
  test/example_test.rb:6:18: Minitest/LiteralAsActualArgument: Replace the literal with the first argument.

Author's Note

This pull request was created with AI assistance to resolve the reported issues. I apologize if extending extend_config functionality 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.

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.

extend_config no longer working with Rubocop 1.72 plugin

1 participant