rspec/rules/S1142/python/rule.adoc

51 lines
850 B
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:47:33 +02:00
include::../description.adoc[]
=== Noncompliant code example
2020-06-30 12:47:33 +02:00
With the default threshold of 3:
2022-02-04 17:28:24 +01:00
[source,python]
2020-06-30 12:47:33 +02:00
----
def fun(): # Noncompliant as there are 4 return statements
if condition1:
return True
elif condition2:
return False
else:
return True
return False
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
This [method|function] has n returns or yields, which is more than the m allowed.
include::../parameters.adoc[]
=== Highlighting
* Primary: on the function name
* Secondary: on ``++return++`` statements
message should be one of:
** "return" statement.
** "yield" statement.
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]