class RuboCop::Cop::Lint::ShadowedArgument

def assignment_without_argument_usage(argument)


shadowing location is not known.
block, it is impossible to tell whether it's executed, so precise
argument at the rhs. If the assignment occurs inside a branch or
Find the first argument assignment, which doesn't reference the
def assignment_without_argument_usage(argument)
  argument.assignments.reduce(true) do |location_known, assignment|
    assignment_node = assignment.meta_assignment_node || assignment.node
    # Shorthand assignments always use their arguments
    next false if assignment_node.shorthand_asgn?
    node_within_block_or_conditional =
      node_within_block_or_conditional?(assignment_node.parent,
                                        argument.scope.node)
    unless uses_var?(assignment_node, argument.name)
      # It's impossible to decide whether a branch or block is executed,
      # so the precise reassignment location is undecidable.
      next false if node_within_block_or_conditional
      yield(assignment.node, location_known)
      break
    end
    location_known
  end
end