class RuboCop::Cop::Layout::MultilineHashKeyLineBreaks
}
c: 3
b: 2,
a: 1,
{
# good
}
c: 3
a: 1, b: 2,
{
# bad
@example
starts on a separate line.
This cop ensures that each key in a multi-line hash
def autocorrect(node)
def autocorrect(node) EmptyLineCorrector.insert_before(node) end
def on_hash(node)
def on_hash(node) # This cop only deals with hashes wrapped by a set of curly # braces like {foo: 1}. That is, not a kwargs hashes. # Style/MultilineMethodArgumentLineBreaks handles those. return unless starts_with_curly_brace?(node) check_line_breaks(node, node.children) if node.loc.begin end
def starts_with_curly_brace?(node)
def starts_with_curly_brace?(node) node.loc.begin end