-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow extensions to disable cop obsoletions #9206
Merged
Merged
Conversation
This file contains 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
dvandersluis
force-pushed
the
obsoletion-disable
branch
from
December 10, 2020 17:01
575b3a2
to
76db56c
Compare
/cc @koic |
Thank you for catching up! I tried applying the following to RuboCop Rails. % git diff
diff --git a/Gemfile b/Gemfile
index 103582220..7daa29aee 100644
--- a/Gemfile
+++ b/Gemfile
diff --git a/Gemfile b/Gemfile
index 103582220..7daa29aee 100644
--- a/Gemfile
+++ b/Gemfile
@@ -9,7 +9,7 @@ gemspec
gem 'bump', require: false
gem 'rake'
gem 'rspec'
-gem 'rubocop', github: 'rubocop-hq/rubocop'
+gem 'rubocop', github: 'dvandersluis/rubocop', branch: 'obsoletion-disable'
gem 'rubocop-performance', '~> 1.9.0'
gem 'rubocop-rspec', '~> 1.29.0'
gem 'simplecov'
diff --git a/config/default.yml b/config/default.yml
index 7d2fe4fd5..17e7a9374 100644
--- a/config/default.yml
+++ b/config/default.yml
@@ -1,5 +1,8 @@
# Common configuration.
+extracted:
+ Rails/*: ~
+
inherit_mode:
merge:
- Exclude
diff --git a/spec/project_spec.rb b/spec/project_spec.rb
index e53a18da6..f0e2b10bd 100644
--- a/spec/project_spec.rb
+++ b/spec/project_spec.rb
@@ -4,10 +4,6 @@ RSpec.describe 'RuboCop Rails Project', type: :feature do
describe 'default configuration file' do
subject(:config) { RuboCop::ConfigLoader.load_file('config/default.yml') }
- before do
- allow_any_instance_of(RuboCop::Config).to receive(:loaded_features).and_return('rubocop-rails') # rubocop:disable RSpec/AnyInstance
- end But the following test failed. % bundle exec rspec spec/project_spec.rb
(snip)
Failures:
1) RuboCop Rails Project default configuration file sorts configuration keys alphabetically
Failure/Error: subject(:config) { RuboCop::ConfigLoader.load_file('config/default.yml') }
RuboCop::ValidationError:
`Rails` cops have been extracted to the `rubocop-rails` gem.
(obsolete configuration found in config/default.yml, please update it)
# ./spec/project_spec.rb:5:in `block (3 levels) in <top (required)>'
# ./spec/project_spec.rb:13:in `block (3 levels) in <top (required)>'
# ./spec/project_spec.rb:43:in `block (3 levels) in <top (required)>'
(snip) Am I using it incorrectly? |
Ah, I get it! Perfect! I will be introducing that to RuboCop Performance and RuboCop Rails after this PR change will be released (Because they need to adjust the supported version of the core). Thank you for the kindness explanation! |
koic
added a commit
to koic/rubocop-rails
that referenced
this pull request
Apr 21, 2021
Follow rubocop/rubocop#9206 and rubocop/rubocop#9143. This PR requires RuboCop 1.7 or higher due to support obsoletion configuration and reverts rubocop@151b8a6.
koic
added a commit
to koic/rubocop-performance
that referenced
this pull request
Apr 21, 2021
Follow rubocop/rubocop#9206 and rubocop/rubocop#9143. This PR requires RuboCop 1.7 or higher due to support obsoletion configuration and reverts rubocop@0e59891.
renawatson68
added a commit
to renawatson68/performance-develop-rubyonrails
that referenced
this pull request
Sep 23, 2022
Follow rubocop/rubocop#9206 and rubocop/rubocop#9143. This PR requires RuboCop 1.7 or higher due to support obsoletion configuration and reverts rubocop/rubocop-performance@0e59891.
richardstewart0213
added a commit
to richardstewart0213/performance-build-Performance-optimization-analysis-
that referenced
this pull request
Nov 4, 2022
Follow rubocop/rubocop#9206 and rubocop/rubocop#9143. This PR requires RuboCop 1.7 or higher due to support obsoletion configuration and reverts rubocop/rubocop-performance@0e59891.
MarttiCheng
added a commit
to MarttiCheng/Rubocop-Performance
that referenced
this pull request
Sep 28, 2023
Follow rubocop/rubocop#9206 and rubocop/rubocop#9143. This PR requires RuboCop 1.7 or higher due to support obsoletion configuration and reverts rubocop/rubocop-performance@0e59891.
SerhiiMisiura
added a commit
to SerhiiMisiura/Rubocop-Performance
that referenced
this pull request
Oct 5, 2023
Follow rubocop/rubocop#9206 and rubocop/rubocop#9143. This PR requires RuboCop 1.7 or higher due to support obsoletion configuration and reverts rubocop/rubocop-performance@0e59891.
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.
Noticed this change made to
rubocop-rails
. There needs to be a way for an extension to disable an obsoletion (ie. rubocop-rails should not haveRails/*
raise an error)Follows #9143.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.