rspec/rules/S2711/python/rule.adoc

40 lines
703 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
``++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
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,python]
2021-04-28 16:49:39 +02:00
----
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[]