class RuboCop::Cop::InternalAffairs::RedundantLocationArgument
Checks for redundant `location` argument to `#add_offense`. `location` argument has a default value of `:expression` and this method will automatically use it.
@example
# bad add_offense(node, location: :expression) # good add_offense(node) add_offense(node, location: :selector)
Constants
- MSG
Public Instance Methods
autocorrect(node)
click to toggle source
# File lib/rubocop/cop/internal_affairs/redundant_location_argument.rb, line 34 def autocorrect(node) range = offending_range(node) ->(corrector) { corrector.remove(range) } end
offending_range(node)
click to toggle source
# File lib/rubocop/cop/internal_affairs/redundant_location_argument.rb, line 40 def offending_range(node) with_space = range_with_surrounding_space(range: node.loc.expression) range_with_surrounding_comma(with_space, :left) end
on_send(node)
click to toggle source
# File lib/rubocop/cop/internal_affairs/redundant_location_argument.rb, line 30 def on_send(node) redundant_location_argument(node) { |argument| add_offense(argument) } end