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 FactoryBot work as a RuboCop plugin #139

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

Conversation

bquorning
Copy link
Contributor

@bquorning bquorning commented Feb 17, 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).

@@ -23,7 +23,9 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
end

desc 'Run RuboCop over this gem'
RuboCop::RakeTask.new(:internal_investigation)
RuboCop::RakeTask.new(:internal_investigation) do
RuboCop::ConfigLoader.inject_defaults!("#{__dir__}/config/default.yml")
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.

@bquorning bquorning force-pushed the rubocop-plugin branch 3 times, most recently from 6398865 to 8e293e7 Compare February 17, 2025 09:42
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!`.
@bquorning bquorning marked this pull request as ready for review February 17, 2025 10:10
@bquorning bquorning requested a review from a team as a code owner February 17, 2025 10:10
@bquorning
Copy link
Contributor Author

CI failure seems to be caused by the the same issue as rubocop/rubocop-rspec#2044

@bquorning
Copy link
Contributor Author

@koic Thank you for your help so far in rubocop-rspec. But could I ask you to also have a look at this PR, and at rubocop/rubocop-capybara#144 too?

In this PR it seems I get different results from bundle exec rake generate_cops_documentation and bundle exec rake internal_investigation generate_cops_documentation no matter what I do.

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