Class: RuboCop::Cop::Kaizo::PositionalArguments

Inherits:
Base
  • Object
show all
Includes:
ArgumentCounting
Defined in:
lib/rubocop/cop/kaizo/positional_arguments.rb

Overview

Checks that a method does not declare too many positional arguments.

Positional arguments are unnamed and order-dependent, which makes a long list of them especially prone to primitive obsession. Required (arg) and optional (optarg) parameters are counted; *rest and &block are not.

Examples:

Max: 2

# bad
def move(x, y, z)
end

# good
def move(point)
end

Constant Summary collapse

KIND =
"positional arguments".freeze

Constants included from ArgumentCounting

ArgumentCounting::DEFINE_METHODS, ArgumentCounting::KEYWORD_TYPES, ArgumentCounting::MSG, ArgumentCounting::POSITIONAL_TYPES, ArgumentCounting::STRUCT_OR_DATA

Method Summary

Methods included from ArgumentCounting

#on_block, #on_def