rspec/rules/S2711/python/rule.adoc
2022-02-04 16:28:24 +00:00

29 lines
568 B
Plaintext

``++yield++`` and ``++return++`` only make sense in the context of functions. Using them outside a function raises a ``++SyntaxError++``. To break out of a loop, use ``++break++`` instead.
== Noncompliant Code Example
[source,python]
----
class MyClass:
while True:
return False #Noncompliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]