Sha256: f5dd349e40f7581181ac3c9fae5acc2c21b2cd20761c116e5389965506b10afc

Contents?: true

Size: 437 Bytes

Versions: 9

Compression:

Stored size: 437 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # Checks for uses of semicolon in if statements.
      class IfWithSemicolon < Cop
        include IfThenElse

        def offending_line(node)
          node.loc.begin.line if node.loc.begin && node.loc.begin.is?(';')
        end

        def error_message(_node)
          'Never use if x; Use the ternary operator instead.'
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubocop-0.22.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.21.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.20.1 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.20.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.19.1 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.19.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.18.1 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.18.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.17.0 lib/rubocop/cop/style/if_with_semicolon.rb