Sha256: 57db93a365875c9756495daf79b0c8f814b2d5e05c243119afb3fa92fd78dfca

Contents?: true

Size: 430 Bytes

Versions: 12

Compression:

Stored size: 430 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
          'Never use if x; Use the ternary operator instead.'
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
rubocop-0.16.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.15.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.14.1 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.14.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.13.1 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.13.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.12.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.11.1 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.11.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.10.0 lib/rubocop/cop/style/if_with_semicolon.rb
rubocop-0.9.1 lib/rubocop/cop/style/if_with_semicolon.rb
sabat-rubocop-0.9.0 lib/rubocop/cop/style/if_with_semicolon.rb