-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
@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 The error suggests that the rubocop-capybara cops is being run, even though they are not listed under I have a similar branch with similar changes in rubocop-factory_bot, and the same thing happens – exceptions from one of the |
8895af6
to
a974f3b
Compare
Rakefile
Outdated
RuboCop::RakeTask.new(:internal_investigation) do | ||
RuboCop::ConfigLoader.inject_defaults!("#{__dir__}/config/default.yml") | ||
end |
There was a problem hiding this comment.
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.
Wouldn't using the |
a974f3b
to
5934338
Compare
Using |
As a short answer, the following addition to diff --git a/.rubocop.yml b/.rubocop.yml
index 6507792..af0958b 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,6 +1,7 @@
inherit_from: .rubocop_todo.yml
plugins:
+ - rubocop-capybara
- rubocop-performance
- rubocop-rake
- rubocop-rspec
diff --git a/Rakefile b/Rakefile
index 22cbb49..7455206 100644
--- a/Rakefile
+++ b/Rakefile
@@ -23,9 +23,7 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
end
desc 'Run RuboCop over this gem'
-RuboCop::RakeTask.new(:internal_investigation) do
- RuboCop::ConfigLoader.inject_defaults!("#{__dir__}/config/default.yml")
-end
+RuboCop::RakeTask.new(:internal_investigation)
desc 'Build config/default.yml'
task :build_config do Technical Note: This is due to the change from With the previous the Now that it has become a plugin, Therefore, to load the configuration, Additionally, |
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!`.
5934338
to
03e94d1
Compare
Thank you @koic, that solved my problems. |
…options This PR prevents errors when internally using cops that rely on configuration options. Please see here for details: rubocop/rubocop-capybara#144 (comment)
cc @ydah |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
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:
master
(if not - rebase it).CHANGELOG.md
if the new code introduces user-observable changes.bundle exec rake
) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).