We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 05cc149 commit 0647c04Copy full SHA for 0647c04
lib/rubocop/cop/metrics/utils/abc_size_calculator.rb
@@ -42,8 +42,7 @@ def initialize(node)
42
end
43
44
def calculate
45
-
46
- @node.each_node do |child|
+ visit_depth_last(@node) do |child|
47
calculate_node(child)
48
49
@@ -75,6 +74,11 @@ def else_branch?(node)
75
74
76
private
77
+ def visit_depth_last(node, &block)
78
+ node.each_child_node { |child| visit_depth_last(child, &block) }
79
+ yield node
80
+ end
81
+
82
def calculate_node(node)
83
@assignment += 1 if assignment?(node)
84
0 commit comments