This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CWE-681 * CWE-681 Update README.md * CWE-681 Update README.md - no spaces * CWE-681 Update README.md
- Loading branch information
Showing
3 changed files
with
17 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
""" Compliant Code Example """ | ||
from decimal import Decimal | ||
|
||
t = Decimal(str(4 / 2)) | ||
print(f"t: {t}") | ||
# t still prints "2.0", but now it's a Decimal | ||
if Decimal("2").compare(t) == 0: | ||
print("t equals 2") | ||
# prints "t equals 2" |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
""" Non-compliant Code Example """ | ||
s = str(4 / 2) | ||
print(f"s: {s}") | ||
# s is "2.0", a string | ||
if s == "2": | ||
print("s equals 2") | ||
# <no output> |
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