Sha256: 2ebe28d7ec1b0ef0e4a07b2ca97c76687cf25520b1cf81d6cfa74da1c8cf9926

Contents?: true

Size: 918 Bytes

Versions: 6

Compression:

Stored size: 918 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # This cops checks for inconsistent indentation.
      #
      # @example
      #
      # class A
      #   def test
      #     puts 'hello'
      #      puts 'world'
      #   end
      # end
      class IndentationConsistency < Cop
        include AutocorrectAlignment

        MSG = 'Inconsistent indentation detected.'

        def on_begin(node)
          check(node)
        end

        def on_kwbegin(node)
          check(node)
        end

        private

        def check(node)
          children_to_check = node.children.reject do |child|
            # Don't check nodes that have special indentation and will be
            # checked by the AccessModifierIndentation cop.
            AccessModifierIndentation.modifier_node?(child)
          end

          check_alignment(children_to_check)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubocop-0.22.0 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.21.0 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.20.1 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.20.0 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.19.1 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.19.0 lib/rubocop/cop/style/indentation_consistency.rb