class RuboCop::Cop::Naming::BinaryOperatorParameterName
def +(other); end
# good
def +(amount); end
# bad
@example
sole parameter named ‘other`.
This cop makes sure that certain binary operator methods have their
def on_def(node)
def on_def(node) op_method_candidate?(node) do |name, arg| return unless op_method?(name) add_offense(arg, :expression, format(MSG, name)) end end
def op_method?(name)
def op_method?(name) return false if BLACKLISTED.include?(name) name !~ /\A\w/ || OP_LIKE_METHODS.include?(name) end