From 48e163d88f81014c243ae508980fae9aec38c7aa Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 31 Oct 2021 11:56:23 +0900 Subject: [PATCH] Bump RuboCop Performance to 1.12.0 This commit bumps RuboCop Performance to 1.12.0 and suppresses the following offense. ```console % bundle exec rubocop -a lib/rubocop/yaml_duplication_checker.rb Inspecting 1 file C Offenses: lib/rubocop/yaml_duplication_checker.rb:26:11: C: [Corrected] Performance/RedundantBlockCall: Use yield instead of on_duplicated.call. on_duplicated.call(exist, key) if exist ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected, 1 offense corrected ``` --- Gemfile | 2 +- lib/rubocop/yaml_duplication_checker.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 099d5086b76..f1a65b02aa5 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'bump', require: false gem 'memory_profiler', platform: :mri gem 'rake', '~> 13.0' gem 'rspec', '~> 3.7' -gem 'rubocop-performance', '~> 1.11.0' +gem 'rubocop-performance', '~> 1.12.0' gem 'rubocop-rake', '~> 0.6.0' gem 'rubocop-rspec', '~> 2.5.0' # Workaround for cc-test-reporter with SimpleCov 0.18. diff --git a/lib/rubocop/yaml_duplication_checker.rb b/lib/rubocop/yaml_duplication_checker.rb index e54f8996107..eef9969f008 100644 --- a/lib/rubocop/yaml_duplication_checker.rb +++ b/lib/rubocop/yaml_duplication_checker.rb @@ -23,7 +23,7 @@ def self.traverse(tree, &on_duplicated) when Psych::Nodes::Mapping tree.children.each_slice(2).with_object([]) do |(key, value), keys| exist = keys.find { |key2| key2.value == key.value } - on_duplicated.call(exist, key) if exist + yield(exist, key) if exist keys << key traverse(value, &on_duplicated) end