Class: Roodi::Checks::CyclomaticComplexityCheck
- Defined in:
- lib/roodi/checks/cyclomatic_complexity_check.rb
Overview
Cyclomatic complexity counts the number of linearly independent paths in the code. The lower the score, the better.
Read more in the inventor Thomas J. McCabe’s original research paper: www.literateprogramming.com/mccabe.pdf
Direct Known Subclasses
CyclomaticComplexityBlockCheck, CyclomaticComplexityMethodCheck
Constant Summary collapse
- COMPLEXITY_NODE_TYPES =
[:if, :while, :until, :for, :rescue, :case, :when, :and, :or]
Constants inherited from Check
Roodi::Checks::Check::NODE_TYPES
Instance Attribute Summary collapse
-
#complexity ⇒ Object
Returns the value of attribute complexity.
Instance Method Summary collapse
-
#initialize ⇒ CyclomaticComplexityCheck
constructor
A new instance of CyclomaticComplexityCheck.
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 ⇒ CyclomaticComplexityCheck
Returns a new instance of CyclomaticComplexityCheck.
16 17 18 19 20 |
# File 'lib/roodi/checks/cyclomatic_complexity_check.rb', line 16 def initialize super() @count = 0 @counting = 0 end |
Instance Attribute Details
#complexity ⇒ Object
Returns the value of attribute complexity.
14 15 16 |
# File 'lib/roodi/checks/cyclomatic_complexity_check.rb', line 14 def complexity @complexity end |