class RuboCop::Cop::Layout::IndentFirstParameter
end
123
second_param)
first_param,
def some_method(
# good
# opening parenthesis.
# The first parameter should always be indented one step more than the
@example EnforcedStyle: align_parentheses
end
123
second_param)
first_param,
def some_method(
# good
# preceding line.
# The first parameter should always be indented one step more than the
@example EnforcedStyle: consistent
end
123
second_param)
first_param,
def some_method(
# bad
@example
not by this cop.
Parameters after the first one are checked by Layout/AlignParameters,
This cop checks the indentation of the first parameter in a method call.
def autocorrect(node)
def autocorrect(node) AlignmentCorrector.correct(processed_source, node, @column_delta) end
def base_description(_)
def base_description(_) if style == brace_alignment_style 'the position of the opening parenthesis' else 'the start of the line where the left parenthesis is' end end
def brace_alignment_style
def brace_alignment_style :align_parentheses end
def check(def_node)
def check(def_node) return if ignored_node?(def_node) left_parenthesis = def_node.arguments.loc.begin first_elem = def_node.arguments.first return unless first_elem return if first_elem.source_range.line == left_parenthesis.line check_first(first_elem, left_parenthesis, nil, 0) end
def message(base_description)
def message(base_description) format( MSG, configured_indentation_width: configured_indentation_width, base_description: base_description ) end
def on_def(node)
def on_def(node) return if node.arguments.empty? return if node.arguments.loc.begin.nil? check(node) end