Class: RuboCop::Cop::Sevencop::MethodDefinitionArgumentsMultiline

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/sevencop/method_definition_arguments_multiline.rb

Overview

Inserts new lines between method definition arguments.

Examples:

# bad
def foo(a, b)
end

# good
def foo(
  a,
  b
)
end

# good
def foo(a)
end

Constant Summary collapse

MSG =
'Insert new lines between method definition arguments.'

Instance Method Summary collapse

Instance Method Details

#on_args(node) ⇒ Object

Parameters:

  • node (RuboCop::AST::ArgsNode)


29
30
31
32
33
34
35
36
# File 'lib/rubocop/cop/sevencop/method_definition_arguments_multiline.rb', line 29

def on_args(node)
  return unless method_args?(node)
  return if multilined?(node)

  add_offense(node) do |corrector|
    autocorrect(corrector, node)
  end
end