Class: Rubocop::Cop::ParameterLists
- Defined in:
- lib/rubocop/cop/parameter_lists.rb
Constant Summary collapse
- MSG =
'Avoid parameter lists longer than %d parameters.'
Instance Attribute Summary
Attributes inherited from Cop
#debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, cop_name, #has_report?, #ignore_node, inherited, #initialize, #inspect, #name
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#max_params ⇒ Object
18 19 20 |
# File 'lib/rubocop/cop/parameter_lists.rb', line 18 def max_params ParameterLists.config['Max'] end |
#on_args(node) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/rubocop/cop/parameter_lists.rb', line 8 def on_args(node) args_count = node.children.size if args_count > max_params add_offence(:convention, node.loc.line, sprintf(MSG, max_params)) end super end |