rspec/rules/S2711/python/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

40 lines
703 B
Plaintext

== Why is this an issue?
``++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)
=== Message
Remove this use of "xxx".
'''
== Comments And Links
(visible only on this page)
=== on 17 Mar 2015, 07:59:40 Elena Vilchik wrote:
Pylint rules
E0104: Return outside function
E0105: Yield outside function
endif::env-github,rspecator-view[]