Skip to content

Commit

Permalink
Modify rule S3518: Correct examples to be valid python code (#3490)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swalkyn authored Dec 11, 2023
1 parent c391438 commit 2032442
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rules/S3518/python/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ The goal is to ensure that a zero value never reaches the denominator.
def foo():
z = 0
if (unknown()):
# ...
z = 4
...
else:
# ...
# (z is not reassigned to a non-zero value here)
z = 1 / z
...
z = 1 / z # Noncompliant: divisor can be 0
----

==== Compliant solution
Expand All @@ -41,11 +41,11 @@ def foo():
def foo():
z = 0
if (unknown()):
# ...
z = 4
...
else:
# ...
z = 1
...
z = 1 / z
----

Expand Down

0 comments on commit 2032442

Please sign in to comment.