Skip to content

Commit

Permalink
Merge pull request #9 from green-code-initiative/ISSUE_10
Browse files Browse the repository at this point in the history
[ISSUE 10] add unit test case to control correction
  • Loading branch information
dedece35 authored Jan 5, 2024
2 parents 8bf211c + 5981679 commit f7d0817
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/avoidMultipleIfElseStatementCompliant.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,19 @@ def compliant_variables_used_max_twice_in_if_orelif_statements_scenario_2():
else:
nb2 = 3
return nb2

# COMPLIANT
# USE CASE (secondary) : check no NullPointerException if no variables really used in conditions
# USE CASE : compliant use case to check if following is OK :
# - more than twice uses of the same variable
# - BUT not directly used, only inside a function
def compliant_the_same_variable_is_used_more_than_twice_but_inside_functions():
nb1 = 3
nb2 = 10
if len(nb1) == 1:
nb2 = 1
elif len(nb1) == 3:
nb2 = 2
else:
nb2 = 4
return nb2

0 comments on commit f7d0817

Please sign in to comment.