diff options
Diffstat (limited to 'Library/Homebrew/rubocops/extend/formula_cop.rb')
| -rw-r--r-- | Library/Homebrew/rubocops/extend/formula_cop.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb index b6fa45d3f..75a3e72d5 100644 --- a/Library/Homebrew/rubocops/extend/formula_cop.rb +++ b/Library/Homebrew/rubocops/extend/formula_cop.rb @@ -167,18 +167,12 @@ module RuboCop nil end - # Returns an array of block nodes of depth first order named block_name below node + # Returns an array of block nodes named block_name inside node def find_blocks(node, block_name) return if node.nil? node.each_child_node(:block).select { |block_node| block_name == block_node.method_name } end - # Returns an array of block nodes of any depth below node in AST - def find_all_blocks(node, block_name) - return if node.nil? - node.each_descendant(:block).select { |block_node| block_name == block_node.method_name } - end - # Returns a method definition node with method_name def find_method_def(node, method_name) return if node.nil? @@ -256,7 +250,8 @@ module RuboCop # Returns the array of arguments of the method_node def parameters(method_node) - method_node.method_args if method_node.send_type? || method_node.block_type? + return unless method_node.send_type? + method_node.method_args end # Returns true if the given parameters are present in method call |
