Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RuboCop Capybara work as a RuboCop plugin #144

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bquorning
Copy link
Contributor

@bquorning bquorning commented Feb 16, 2025

This pull request adds support for RuboCop's plugin feature, added in rubocop/rubocop#13792, released in v1.72.

It replaces the ad-hoc inject_defaults! with RuboCop plugins.

Some Rake tasks may still need to use inject_defaults!.


Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Updated documentation.
  • Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

@bquorning
Copy link
Contributor Author

bquorning commented Feb 16, 2025

@koic I tried replicating your pull requests rubocop/rubocop-performance#490 and rubocop/rubocop-rspec#2042, but both locally and on CI I find that bundle exec rake internal_investigation is failing, while bundle exec rubocop will pass. I was hoping you could help me find out what is going wrong?

The error suggests that the rubocop-capybara cops is being run, even though they are not listed under require or plugins in .rubocop.yml.

I have a similar branch with similar changes in rubocop-factory_bot, and the same thing happens – exceptions from one of the FactoryBot cops, even though those cops should not be loaded. And it’s only a problem when running rake internal_investigation.

@bquorning bquorning marked this pull request as ready for review February 17, 2025 07:53
@bquorning bquorning requested a review from a team as a code owner February 17, 2025 07:53
This pull request adds support for RuboCop's plugin feature, added in
rubocop/rubocop#13792, released in v1.72.

It replaces the ad-hoc `inject_defaults!` with RuboCop plugins.

Some Rake tasks may still need to use `inject_defaults!`.
Comment on lines +26 to +28
RuboCop::RakeTask.new(:internal_investigation) do
RuboCop::ConfigLoader.inject_defaults!("#{__dir__}/config/default.yml")
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don’t understand why this is necessary, and hope to remove it before merging the PR.

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.

1 participant