Sha256: 94c9422f2572b0b1d7b4b8ccb68f5210fff4ed2a20d2139481666c8a03755cd6

Contents?: true

Size: 532 Bytes

Versions: 3

Compression:

Stored size: 532 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    # 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.
        return unless node.loc.expression.source =~ /\A(if|unless)\b/
        return unless offending_line(node)
        add_offence(node, :expression, error_message(node))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.18.1 lib/rubocop/cop/mixin/if_then_else.rb
rubocop-0.18.0 lib/rubocop/cop/mixin/if_then_else.rb
rubocop-0.17.0 lib/rubocop/cop/mixin/if_then_else.rb