Skip to content

Commit

Permalink
fixup! [Fix rubocop#255] Fix a false positive for `Style/RedundantEqu…
Browse files Browse the repository at this point in the history
…alityComparisonBlock`
  • Loading branch information
koic committed Aug 10, 2021
1 parent d54f15e commit cd08f3e
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -88,13 +88,15 @@ def new_argument(block_argument, block_body)

def use_block_argument_in_method_argument_of_operand?(block_argument, operand)
return false unless operand.send_type?
return true if operand.arguments.map(&:source).any?(block_argument.source)

operand.arguments.each do |argument|
return true if argument.each_descendant(:lvar).map(&:source).any?(block_argument.source)
arguments = operand.arguments
operand_sources = arguments.map(&:source)

arguments.each do |argument|
operand_sources += argument.each_descendant(:lvar).map(&:source)
end

false
operand_sources.any?(block_argument.source)
end

def offense_range(node)
Expand Down

0 comments on commit cd08f3e

Please sign in to comment.