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]'
Instance Attribute Summary
Attributes inherited from Cop
#autocorrect, #corrections, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, all, #autocorrect_action, cop_name, cop_type, #do_autocorrect, #ignore_node, inherited, #initialize, lint?, #name, rails?, style?
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? MethodLength.config['CountComments'] end |
#max_length ⇒ Object
20 21 22 |
# File 'lib/rubocop/cop/style/method_length.rb', line 20 def max_length MethodLength.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 |