rspec/rules/S6680/python/rule.adoc

56 lines
896 B
Plaintext

include::../summary.adoc[]
== Why is this an issue?
include::../rationale.adoc[]
include::../impact.adoc[]
== How to fix it
=== Code examples
==== Noncompliant code example
[source,csharp,diff-id=1,diff-type=noncompliant]
----
def example():
limit = int(request.args.get('limit'))
for _ in range(limit):
# ...
----
==== Compliant solution
[source,csharp,diff-id=1,diff-type=compliant]
----
def example():
limit = int(request.args.get('limit'))
restricted_limit = min(10, limit)
for _ in range(restricted_limit):
# ...
----
=== How does this work?
include::../common/fix/limits.adoc[]
== Resources
include::../common/resources/standards.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
'''
endif::env-github,rspecator-view[]