Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE 10] add unit test case to control correction #9

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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