-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from rohaquinlop/issue-5
feat(build): fix cognitive complexity algorithm
- Loading branch information
Showing
6 changed files
with
34 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
def function(): | ||
for i in range(10): | ||
if i == 5: | ||
break | ||
continue | ||
print(i) | ||
for i in range(10): # 1 | ||
if i == 5: # 2 (nested = 1) | ||
break # 0 (nested = 2) | ||
continue # 0 (nested = 1) | ||
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
def sum_values(values): | ||
total = 0 | ||
for value in values: | ||
for value in values: # 1 (nested = 0) | ||
total += value | ||
return total | ||
|
||
|
||
def sum_values_with_if(values): | ||
total = 0 | ||
for value in values: | ||
if value > 0 and value < 10 and value % 2 == 0: | ||
for value in values: # 1 (nested = 0) | ||
if value > 0 and value < 10 and value % 2 == 0: # [2] + 1 (nested = 1) | ||
total += value | ||
return total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
if "1" == "1": | ||
print(1) | ||
if "2" == "2" and "3" == "3": | ||
print(1) | ||
print(1) |