From 6ae0409687a45d6c8792a7318d0ed1d0abeb96ef Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Tue, 13 Jul 2021 19:31:18 +0700 Subject: [PATCH] Fixed the Fact func logic on test code --- testdata/src/a/a.go | 2 +- testdata/src/b/b.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testdata/src/a/a.go b/testdata/src/a/a.go index a1fc102..dbdcafa 100644 --- a/testdata/src/a/a.go +++ b/testdata/src/a/a.go @@ -52,7 +52,7 @@ func Fact(n int) int { // want "cognitive complexity 3 of func Fact is high \\(> if n <= 1 { // +1 return 1 } else { // +1 - return n + Fact(n-1) // +1 + return n * Fact(n-1) // +1 } } // total complexity = 3 diff --git a/testdata/src/b/b.go b/testdata/src/b/b.go index e97eda9..830da87 100644 --- a/testdata/src/b/b.go +++ b/testdata/src/b/b.go @@ -52,7 +52,7 @@ func Fact(n int) int { if n <= 1 { // +1 return 1 } else { // +1 - return n + Fact(n-1) // +1 + return n * Fact(n-1) // +1 } } // total complexity = 3