Sha256: 175dedc4bf28b779139ddc06af78b164f5634e6cd576244321726f6b997d3ed0

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 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
        include AccessModifierNode

        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.
            modifier_node?(child)
          end

          check_alignment(children_to_check)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.29.1 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.29.0 lib/rubocop/cop/style/indentation_consistency.rb