Sha256: b6b11d112adf881f2c5b08eb9644c7b25cbb1b7ae23bc1bc7f34c2d5f203dae0

Contents?: true

Size: 927 Bytes

Versions: 10

Compression:

Stored size: 927 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

10 entries across 10 versions & 2 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/indentation_consistency.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rubocop-0.26.0/lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.28.0 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.27.1 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.27.0 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.26.1 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.26.0 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.25.0 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.24.1 lib/rubocop/cop/style/indentation_consistency.rb
rubocop-0.24.0 lib/rubocop/cop/style/indentation_consistency.rb