class RuboCop::Cop::InternalAffairs::RedundantMessageArgument
add_offense(node)
# good
add_offense(node, message: MSG)
# bad
@example
if they are defined.
will automatically use ‘#message` or `MSG` (in that order of priority)
Checks for redundant message arguments to `#add_offense`. This method
def offending_range(node)
def offending_range(node) with_space = range_with_surrounding_space(node.source_range) range_with_surrounding_comma(with_space, :left) end
def on_send(node)
def on_send(node) return unless (kwargs = node_type_check(node)) kwargs.pairs.each do |pair| redundant_message_argument(pair) do add_offense(pair) do |corrector| range = offending_range(pair) corrector.remove(range) end end end end