2023-08-07 14:46:53 +02:00

49 lines
1.0 KiB
Plaintext

This rule raises an issue when a `pass` statement is redundant.
== Why is this an issue?
The use of a `pass` statement where it is not required by the syntax is redundant. It makes the code less readable and its intent confusing.
To fix this issue, remove `pass` statements that do not affect the behaviour of the program.
=== Code examples
==== Noncompliant code example
[source,python,diff-id=1,diff-type=noncompliant]
----
def foo(arg):
print(arg)
pass # Noncompliant: the `pass` statement is not needed as it does not change the behaviour of the program.
----
==== Compliant solution
[source,python,diff-id=1,diff-type=compliant]
----
def foo(arg):
print(arg)
----
== Resources
=== Documentation
* Python Documentation - https://docs.python.org/3/reference/simple_stmts.html#the-pass-statement[The pass statement]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this unneeded "pass".
endif::env-github,rspecator-view[]