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, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, #autocorrect_action, cop_name, cop_type, #do_autocorrect, #ignore_node, inherited, #initialize, #inspect, lint?, #name, rails?, style?
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#count_comments? ⇒ Boolean
28 29 30 |
# File 'lib/rubocop/cop/style/method_length.rb', line 28 def count_comments? MethodLength.config['CountComments'] end |
#max_length ⇒ Object
24 25 26 |
# File 'lib/rubocop/cop/style/method_length.rb', line 24 def max_length MethodLength.config['Max'] end |
#on_def(node) ⇒ Object
12 13 14 15 16 |
# File 'lib/rubocop/cop/style/method_length.rb', line 12 def on_def(node) check(node) super end |
#on_defs(node) ⇒ Object
18 19 20 21 22 |
# File 'lib/rubocop/cop/style/method_length.rb', line 18 def on_defs(node) check(node) super end |