class RuboCop::Cop::InternalAffairs::RedundantLocationArgument
add_offense(node, location: :selector)
add_offense(node)
# good
add_offense(node, location: :expression)
# bad
@example
automatically use it.
argument has a default value of ‘:expression` and this method will
Checks for redundant `location` argument to `#add_offense`. `location`
def offending_range(node)
def offending_range(node) with_space = range_with_surrounding_space(node.loc.expression) range_with_surrounding_comma(with_space, :left) end
def on_send(node)
def on_send(node) redundant_location_argument(node) do |argument| add_offense(argument) do |corrector| range = offending_range(argument) corrector.remove(range) end end end