Class: Rubocop::Cop::Style::IfWithSemicolon
- Includes:
- IfThenElse
- Defined in:
- lib/rubocop/cop/style/if_then_else.rb
Overview
Checks for uses of semicolon in if statements.
Instance Attribute Summary
Attributes inherited from Cop
#autocorrect, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods included from IfThenElse
Methods inherited from Cop
#add_offence, #autocorrect_action, cop_name, #do_autocorrect, #ignore_node, inherited, #initialize, #inspect, #name, rails?
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#error_message ⇒ Object
36 37 38 |
# File 'lib/rubocop/cop/style/if_then_else.rb', line 36 def 'Never use if x; Use the ternary operator instead.' end |
#offending_line(node) ⇒ Object
32 33 34 |
# File 'lib/rubocop/cop/style/if_then_else.rb', line 32 def offending_line(node) node.loc.begin.line if node.loc.begin && node.loc.begin.is?(';') end |