Class: Roodi::Checks::NpathComplexityCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/roodi/checks/npath_complexity_check.rb

Direct Known Subclasses

NpathComplexityMethodCheck

Constant Summary collapse

MULTIPLYING_NODE_TYPES =

, :when, :and, :or

[:if, :while, :until, :for, :case]
ADDING_NODE_TYPES =
[:rescue]
COMPLEXITY_NODE_TYPES =
MULTIPLYING_NODE_TYPES + ADDING_NODE_TYPES

Constants inherited from Check

Check::NODE_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

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(complexity) ⇒ NpathComplexityCheck

Returns a new instance of NpathComplexityCheck.



13
14
15
16
17
18
# File 'lib/roodi/checks/npath_complexity_check.rb', line 13

def initialize(complexity)
  super()
  @complexity = complexity
  @value_stack = []
  @current_value = 1
end

Instance Attribute Details

#complexityObject

Returns the value of attribute complexity.



11
12
13
# File 'lib/roodi/checks/npath_complexity_check.rb', line 11

def complexity
  @complexity
end

Instance Method Details

#evalute_start_case(node) ⇒ Object



36
37
38
# File 'lib/roodi/checks/npath_complexity_check.rb', line 36

def evalute_start_case(node)
  push_value
end

#evalute_start_for(node) ⇒ Object



32
33
34
# File 'lib/roodi/checks/npath_complexity_check.rb', line 32

def evalute_start_for(node)
  push_value
end

#evalute_start_if(node) ⇒ Object



20
21
22
# File 'lib/roodi/checks/npath_complexity_check.rb', line 20

def evalute_start_if(node)
  push_value
end

#evalute_start_rescue(node) ⇒ Object



40
41
42
# File 'lib/roodi/checks/npath_complexity_check.rb', line 40

def evalute_start_rescue(node)
  push_value
end

#evalute_start_until(node) ⇒ Object



28
29
30
# File 'lib/roodi/checks/npath_complexity_check.rb', line 28

def evalute_start_until(node)
  push_value
end

#evalute_start_while(node) ⇒ Object



24
25
26
# File 'lib/roodi/checks/npath_complexity_check.rb', line 24

def evalute_start_while(node)
  push_value
end