class RuboCop::Cop::Layout::SpaceAroundOperators

def offense_message(type, operator, with_space, right_operand)

def offense_message(type, operator, with_space, right_operand)
  if should_not_have_surrounding_space?(operator)
    return if with_space.is?(operator.source)
    "Space around operator `#{operator.source}` detected."
  elsif !/^\s.*\s$/.match?(with_space.source)
    "Surrounding space missing for operator `#{operator.source}`."
  elsif excess_leading_space?(type, operator, with_space) ||
        excess_trailing_space?(right_operand, with_space)
    "Operator `#{operator.source}` should be surrounded " \
      'by a single space.'
  end
end