Class: Rubocop::Cop::Style::ParameterLists
- Defined in:
- lib/rubocop/cop/style/parameter_lists.rb
Overview
This cop checks for methods with too many parameters. The maximum number of parameters in configurable. On Ruby 2.0+ keyword arguments can optionally be excluded from the total count.
Constant Summary collapse
- MSG =
'Avoid parameter lists longer than %d parameters.'
Constants inherited from Cop
Instance Attribute Summary
Attributes inherited from Cop
#config, #corrections, #offences, #processed_source
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect?, #convention, #cop_config, cop_name, #cop_name, cop_type, #debug?, #ignore_node, inherited, #initialize, lint?, #message, non_rails, rails?, style?, #support_autocorrect?, #warning
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#on_args(node) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rubocop/cop/style/parameter_lists.rb', line 13 def on_args(node) if args_count(node) > max_params convention(node, :expression, sprintf(MSG, max_params)) end end |