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

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

def foo(arg):
    print(arg)

Resources

Documentation