-
Notifications
You must be signed in to change notification settings - Fork 184
pySCG: adding 783 as part of #531 #993
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
Conversation
Signed-off-by: Helge Wehder <[email protected]>
reviewing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just have one comment on the "noncompliant01.py" description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of suggestions. The bibliography is partially incorrect.
Overall, this is a great rule for the introductory section since it touches on some programming basics!
docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/noncompliant01.py
Outdated
Show resolved
Hide resolved
"""Compliant Code Example""" | ||
|
||
|
||
def label(number: int): | ||
if number < 0: | ||
return "neg" | ||
if number % 2 == 0: | ||
return "even" | ||
if number < 5: | ||
return "small" | ||
return "big" | ||
|
||
|
||
for number in range(-3, 3): | ||
print(f"{number} = {label(number)}") |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not tried but we could potentially update the noncompliant01.py
to support multiple labels.
Signed-off-by: Helge Wehder <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the changes, the rule looks good to me.
2x+1 merging |
part of #531