class RuboCop::Cop::Style::AlignParameters
aligned.
Here we check if the parameters on a multi-line method call are
def base_column(node, args)
def base_column(node, args) if fixed_indentation? lineno = target_method_lineno(node) line = node.loc.expression.source_buffer.source_line(lineno) indentation_of_line = /\S.*/.match(line).begin(0) indentation_of_line + configured_indentation_width else args.first.loc.column end end
def fixed_indentation?
def fixed_indentation? cop_config['EnforcedStyle'] == 'with_fixed_indentation' end
def on_send(node)
def on_send(node) _receiver, method, *args = *node return if method == :[]= return if args.size <= 1 check_alignment(args, base_column(node, args)) end
def target_method_lineno(node)
def target_method_lineno(node) if node.loc.selector node.loc.selector.line else # l.(1) has no selector, so we use the opening parenthesis instead node.loc.begin.line end end