Class: Rubocop::Cop::Style::ClassLength
- Includes:
- Util
- Defined in:
- lib/rubocop/cop/style/class_length.rb
Overview
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Constant Summary collapse
- MSG =
'Class definition is too long. [%d/%d]'
Constants inherited from Cop
Instance Attribute Summary
Attributes inherited from Cop
#config, #corrections, #offences, #processed_source
Instance Method Summary collapse
Methods included from Util
block_length, comment_line?, const_name, line_range, source_length, strip_quotes
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
22 23 24 |
# File 'lib/rubocop/cop/style/class_length.rb', line 22 def count_comments? cop_config['CountComments'] end |
#max_length ⇒ Object
18 19 20 |
# File 'lib/rubocop/cop/style/class_length.rb', line 18 def max_length cop_config['Max'] end |
#on_class(node) ⇒ Object
14 15 16 |
# File 'lib/rubocop/cop/style/class_length.rb', line 14 def on_class(node) check(node) end |