File tree Expand file tree Collapse file tree 3 files changed +0
-29
lines changed Expand file tree Collapse file tree 3 files changed +0
-29
lines changed Original file line number Diff line number Diff line change @@ -304,11 +304,6 @@ func (v *complexityVisitor) visitCallExpr(n *ast.CallExpr) ast.Visitor {
304
304
if obj == v .name .Obj && name == v .name .Name {
305
305
// called by same function directly (direct recursion)
306
306
v .incComplexity ()
307
- } else if obj != nil {
308
- if fnDecl , ok := obj .Decl .(* ast.FuncDecl ); ok {
309
- // called by same function indirectly (indirect recursion)
310
- ast .Walk (v , fnDecl )
311
- }
312
307
}
313
308
}
314
309
return v
Original file line number Diff line number Diff line change @@ -125,18 +125,6 @@ func FactRec(n int) int { // want "cognitive complexity 3 of func FactRec is hig
125
125
}
126
126
} // total complexity = 3
127
127
128
- func FactRecIndirect (n int ) int { // want "cognitive complexity 3 of func FactRecIndirect is high \\(> 0\\)"
129
- if n <= 1 { // +1
130
- return 1
131
- } else { // +1
132
- return factRecIndirect0 (n ) // +0 +1, due to indirect call to FactRecIndirect
133
- }
134
- } // total complexity = 3
135
-
136
- func factRecIndirect0 (n int ) int { // want "cognitive complexity 3 of func factRecIndirect0 is high \\(> 0\\)"
137
- return n * FactRecIndirect (n - 1 ) // +0 +3 due to inderect call to factRecIndirect0
138
- } // total complexity = 3
139
-
140
128
func FactLoop (n int ) int { // want "cognitive complexity 1 of func FactLoop is high \\(> 0\\)"
141
129
total := 1
142
130
for n > 0 { // +1
Original file line number Diff line number Diff line change @@ -125,18 +125,6 @@ func FactRec(n int) int {
125
125
}
126
126
} // total complexity = 3
127
127
128
- func FactRecIndirect (n int ) int {
129
- if n <= 1 { // +1
130
- return 1
131
- } else { // +1
132
- return factRecIndirect0 (n ) // +0 +1, due to indirect call to FactRecIndirect
133
- }
134
- } // total complexity = 3
135
-
136
- func factRecIndirect0 (n int ) int {
137
- return n * FactRecIndirect (n - 1 ) // +0 +3 due to inderect call to factRecIndirect0
138
- } // total complexity = 3
139
-
140
128
func FactLoop (n int ) int {
141
129
total := 1
142
130
for n > 0 { // +1
You can’t perform that action at this time.
0 commit comments