Class: Rubocop::Cop::WhenThen
- Defined in:
- lib/rubocop/cop/when_then.rb
Constant Summary collapse
- MSG =
'Never use "when x;". Use "when x then" instead.'
Instance Attribute Summary
Attributes inherited from Cop
#debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, cop_name, #has_report?, inherited, #initialize, #inspect, #name, #on_comment
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_when(node) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/rubocop/cop/when_then.rb', line 8 def on_when(node) if node.loc.begin && node.loc.begin.source == ';' add_offence(:convention, node.loc.line, MSG) end super end |