Class: RuboCop::Cop::Layout::SpaceAroundOperators

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/layout/space_around_operators.rb

Instance Method Summary collapse

Methods inherited from Cop

#message

Instance Method Details

#offense_message(operator, with_space, right_operand) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/rubocop/cop/layout/space_around_operators.rb', line 7

def offense_message(operator, with_space, right_operand)
  if operator.is?('**')
    "ζ*'ヮ')ζ<うっうー!`**`のまわりにスペースがありますよー!" unless with_space.is?('**')
  elsif with_space.source !~ /^\s.*\s$/
    "ζ*'ヮ')ζ<うっうー!`#{operator.source}`のまわりにスペースがありませんよー!"
  elsif excess_leading_space?(operator, with_space) ||
        excess_trailing_space?(right_operand, with_space)
    "ζ*'ヮ')ζ<うっうー!`#{operator.source}`のまわりはスペース1こあけましょうねー!"
  end
end