class Rubocop::Cop::Style::IfWithSemicolon

Checks for uses of semicolon in if statements.

Public Instance Methods

error_message() click to toggle source
# File lib/rubocop/cop/style/if_with_semicolon.rb, line 14
def error_message
  'Never use if x; Use the ternary operator instead.'
end
offending_line(node) click to toggle source
# File lib/rubocop/cop/style/if_with_semicolon.rb, line 10
def offending_line(node)
  node.loc.begin.line if node.loc.begin && node.loc.begin.is?(';')
end