From a1553666bc84dc56e73c7a39f8dec12c1a14993f Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Wed, 21 Apr 2021 19:49:53 +0900 Subject: [PATCH] Require RuboCop 1.7 or higher due to support obsoletion configuration Follow https://github.com/rubocop-hq/rubocop/pull/9206 and https://github.com/rubocop-hq/rubocop/pull/9143. This PR requires RuboCop 1.7 or higher due to support obsoletion configuration and reverts https://github.com/rubocop/rubocop-performance/commit/0e59891. --- CHANGELOG.md | 1 + config/obsoletion.yml | 7 +++++++ lib/rubocop/performance.rb | 2 ++ rubocop-performance.gemspec | 2 +- spec/project_spec.rb | 4 ---- 5 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 config/obsoletion.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index df7b678634..c75869532c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * [#228](https://github.com/rubocop/rubocop-performance/pull/228): Mark `Performance/RedundantMerge` as unsafe. ([@dvandersluis][]) * [#232](https://github.com/rubocop/rubocop-performance/pull/232): Drop Ruby 2.4 support. ([@koic][]) +* [#235](https://github.com/rubocop/rubocop-performance/pull/235): Require RuboCop 1.7 or higher. ([@koic][]) ## 1.10.2 (2021-03-23) diff --git a/config/obsoletion.yml b/config/obsoletion.yml new file mode 100644 index 0000000000..2aade6c413 --- /dev/null +++ b/config/obsoletion.yml @@ -0,0 +1,7 @@ +# +# Configuration for obsoletion. +# +# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions +# +extracted: + Performance/*: ~ diff --git a/lib/rubocop/performance.rb b/lib/rubocop/performance.rb index 2035903521..4ed61a2fa0 100644 --- a/lib/rubocop/performance.rb +++ b/lib/rubocop/performance.rb @@ -8,5 +8,7 @@ module Performance CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT) + + ::RuboCop::ConfigObsoletion.files << PROJECT_ROOT.join('config', 'obsoletion.yml') end end diff --git a/rubocop-performance.gemspec b/rubocop-performance.gemspec index 790e8b43bb..8301c7d322 100644 --- a/rubocop-performance.gemspec +++ b/rubocop-performance.gemspec @@ -29,6 +29,6 @@ Gem::Specification.new do |s| 'bug_tracker_uri' => 'https://github.com/rubocop/rubocop-performance/issues' } - s.add_runtime_dependency('rubocop', '>= 0.90.0', '< 2.0') + s.add_runtime_dependency('rubocop', '>= 1.7.0', '< 2.0') s.add_runtime_dependency('rubocop-ast', '>= 0.4.0') end diff --git a/spec/project_spec.rb b/spec/project_spec.rb index 0dfd6594a9..e30eed85fb 100644 --- a/spec/project_spec.rb +++ b/spec/project_spec.rb @@ -4,10 +4,6 @@ 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-performance') # rubocop:disable RSpec/AnyInstance - end - let(:registry) { RuboCop::Cop::Registry.global } let(:cop_names) do registry.with_department(:Performance).cops.map(&:cop_name)