Class: Roodi::Checks::MethodLineCountCheck
- Inherits:
-
LineCountCheck
- Object
- Check
- LineCountCheck
- Roodi::Checks::MethodLineCountCheck
- Defined in:
- lib/roodi/checks/method_line_count_check.rb
Overview
Checks a method to make sure the number of lines it has is under the specified limit.
A method getting too large is a code smell that indicates it might be doing more than one thing and becoming hard to test. It should probably be refactored into multiple methods that each do a single thing well.
Constant Summary collapse
- DEFAULT_LINE_COUNT =
20
Constants inherited from Check
Instance Attribute Summary
Attributes inherited from LineCountCheck
Instance Method Summary collapse
-
#initialize ⇒ MethodLineCountCheck
constructor
A new instance of MethodLineCountCheck.
- #interesting_nodes ⇒ Object
- #message_prefix ⇒ Object
Methods inherited from LineCountCheck
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
#initialize ⇒ MethodLineCountCheck
Returns a new instance of MethodLineCountCheck.
14 15 16 17 |
# File 'lib/roodi/checks/method_line_count_check.rb', line 14 def initialize super() self.line_count = DEFAULT_LINE_COUNT end |
Instance Method Details
#interesting_nodes ⇒ Object
19 20 21 |
# File 'lib/roodi/checks/method_line_count_check.rb', line 19 def interesting_nodes [:defn] end |
#message_prefix ⇒ Object
23 24 25 |
# File 'lib/roodi/checks/method_line_count_check.rb', line 23 def 'Method' end |