Class: Roodi::Checks::ClassLineCountCheck

Inherits:
LineCountCheck show all
Defined in:
lib/roodi/checks/class_line_count_check.rb

Overview

Checks a class to make sure the number of lines it has is under the specified limit.

A class getting too large is a code smell that indicates it might be taking on too many responsibilities. It should probably be refactored into multiple smaller classes.

Constant Summary collapse

DEFAULT_LINE_COUNT =
300

Constants inherited from Check

Roodi::Checks::Check::NODE_TYPES

Instance Attribute Summary

Attributes inherited from LineCountCheck

#line_count

Instance Method Summary collapse

Methods inherited from LineCountCheck

#evaluate_start

Methods inherited from Check

#add_error, #end_file, #errors, #evaluate_end, #evaluate_node, #evaluate_node_end, #evaluate_node_start, #evaluate_start, make, #position, #start_file

Constructor Details

#initializeClassLineCountCheck

Returns a new instance of ClassLineCountCheck.



13
14
15
16
# File 'lib/roodi/checks/class_line_count_check.rb', line 13

def initialize
  super()
  self.line_count = DEFAULT_LINE_COUNT
end

Instance Method Details

#interesting_nodesObject



18
19
20
# File 'lib/roodi/checks/class_line_count_check.rb', line 18

def interesting_nodes
  [:class]
end

#message_prefixObject



22
23
24
# File 'lib/roodi/checks/class_line_count_check.rb', line 22

def message_prefix
  'Class'
end