Sha256: fa67cb0d90c7a663895bfd0bb7ec8973b89b81a31165f96ca0a816d5ee0aebdc

Contents?: true

Size: 594 Bytes

Versions: 5

Compression:

Stored size: 594 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # Common functionality for cops checking if and unless statements.
      module IfThenElse
        def on_if(node)
          check(node)
        end

        def on_unless(node)
          check(node)
        end

        def check(node)
          # We won't check modifier or ternary conditionals.
          if node.loc.expression.source =~ /\A(if|unless)\b/
            if offending_line(node)
              convention(node, :expression, error_message)
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.15.0 lib/rubocop/cop/style/if_then_else.rb
rubocop-0.14.1 lib/rubocop/cop/style/if_then_else.rb
rubocop-0.14.0 lib/rubocop/cop/style/if_then_else.rb
rubocop-0.13.1 lib/rubocop/cop/style/if_then_else.rb
rubocop-0.13.0 lib/rubocop/cop/style/if_then_else.rb