class RuboCop::Cop::Layout::IndentationConsistency
end
end
def bar
private
end
def foo
protected
end
puts ‘world’
puts ‘hello’
def test
class A
# good
end
end
puts ‘world’
puts ‘hello’
def test
class A
# good
end
end
def bar
private
end
def foo
protected
end
puts ‘world’
puts ‘hello’
def test
class A
# bad
end
end
puts ‘world’
puts ‘hello’
def test
class A
# bad
@example EnforcedStyle: rails
end
end
def bar
private
end
def foo
protected
end
puts ‘world’
puts ‘hello’
def test
class A
# good
end
end
puts ‘world’
puts ‘hello’
def test
class A
# good
end
end
def bar
private
end
def foo
protected
end
puts ‘world’
puts ‘hello’
def test
class A
# bad
end
end
puts ‘world’
puts ‘hello’
def test
class A
# bad
@example EnforcedStyle: normal (default)
logical depth shall have the same indentation.
modifiers. Other than that, both styles mean that entities on the same
protected and private members shall be indented one step more than the
modifier keywords shall be indented the same as public methods and that
prescribes that in classes and modules the ‘protected` and `private`
The difference between `rails` and `normal` is that the `rails` style
This cops checks for inconsistent indentation.
def autocorrect(node)
def autocorrect(node) AlignmentCorrector.correct(processed_source, node, column_delta) end
def check(node)
def check(node) children_to_check = [[]] node.children.each do |child| # Modifier nodes have special indentation and will be checked by # the AccessModifierIndentation cop. This cop uses them as dividers # in rails mode. Then consistency is checked only within each # section delimited by a modifier node. if child.send_type? && child.bare_access_modifier? children_to_check << [] if style == :rails else children_to_check.last << child end end children_to_check.each { |group| check_alignment(group) } end
def on_begin(node)
def on_begin(node) check(node) end
def on_kwbegin(node)
def on_kwbegin(node) check(node) end