Class: Rubocop::Cop::Style::MethodLength
- Defined in:
- lib/rubocop/cop/style/method_length.rb
Overview
This cop checks if the length a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Constant Summary collapse
- MSG =
'Method has too many lines. [%d/%d]'
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
#count_comments? ⇒ Boolean
24 25 26 |
# File 'lib/rubocop/cop/style/method_length.rb', line 24 def count_comments? cop_config['CountComments'] end |
#max_length ⇒ Object
20 21 22 |
# File 'lib/rubocop/cop/style/method_length.rb', line 20 def max_length cop_config['Max'] end |
#on_def(node) ⇒ Object
12 13 14 |
# File 'lib/rubocop/cop/style/method_length.rb', line 12 def on_def(node) check(node) end |
#on_defs(node) ⇒ Object
16 17 18 |
# File 'lib/rubocop/cop/style/method_length.rb', line 16 def on_defs(node) check(node) end |