class RuboCop::Cop::Style::MultilineMethodDefinitionBraceLayout

This cop checks that the closing brace in a method definition is symmetrical with respect to the opening brace and the method parameters.

If a method definition's opening brace is on the same line as the first parameter of the definition, then the closing brace should be on the same line as the last parameter of the definition.

If a method definition's opening brace is on a separate line from the first parameter of the definition, then the closing brace should be on the line after the last parameter of the definition.

@example

# bad
def foo(a,
  b
  )
end

# bad
def foo(
  a,
  b)
end

# good
def foo(a,
  b)
end

#good
def foo(
  a,
  b
)
end

Constants

NEW_LINE_MESSAGE
SAME_LINE_MESSAGE

Public Instance Methods

on_method_def(_node, _method_name, args, _body) click to toggle source
# File lib/rubocop/cop/style/multiline_method_definition_brace_layout.rb, line 55
def on_method_def(_node, _method_name, args, _body)
  check_brace_layout(args)
end