From 4eed898f2fafcf22ebdedbc07667f742045dcb8d Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 2 Aug 2020 09:33:16 +0900 Subject: [PATCH] Suppress `Style/ExplicitBlockArgument`'s offenses Follow https://github.com/rubocop-hq/rubocop/pull/8415 This commit suppresses the following `Style/ExplicitBlockArgument`'s offenses. ```console % bundle exec rake (snip) Offenses: lib/rubocop/rails/schema_loader/schema.rb:105:13: C: Style/ExplicitBlockArgument: Consider using explicit block argument in the surrounding method's signature over yield. node.body.children.each do |child| ... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 181 files inspected, 1 offense detected RuboCop failed! ``` --- lib/rubocop/rails/schema_loader/schema.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/rubocop/rails/schema_loader/schema.rb b/lib/rubocop/rails/schema_loader/schema.rb index 6cd6d8f013..9f844d110d 100644 --- a/lib/rubocop/rails/schema_loader/schema.rb +++ b/lib/rubocop/rails/schema_loader/schema.rb @@ -97,14 +97,12 @@ def build_indices(node) end.compact end - def each_content(node) + def each_content(node, &block) return enum_for(__method__, node) unless block_given? case node.body&.type when :begin - node.body.children.each do |child| - yield(child) - end + node.body.children.each(&block) else yield(node.body) end