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 autocorrect(node)
def autocorrect(node) range = offending_range(node) ->(corrector) { corrector.remove(range) } end
def offending_range(node)
def offending_range(node) with_space = range_with_surrounding_space(range: node.loc.expression) range_with_surrounding_comma(with_space, :left) end
def on_send(node)
def on_send(node) redundant_location_argument(node) { |argument| add_offense(argument) } end