class RuboCop::Cop::Style::IfWithSemicolon

Checks for uses of semicolon in if statements.

@example

# bad
result = if some_condition; something else another_thing end

# good
result = some_condition ? something : another_thing

Constants

MSG

Public Instance Methods

on_normal_if_unless(node) click to toggle source
# File lib/rubocop/cop/style/if_with_semicolon.rb, line 21
def on_normal_if_unless(node)
  beginning = node.loc.begin
  return unless beginning&.is?(';')

  add_offense(node)
end