Skip to content

unnecessary-placeholder

Pythonstyleno fixdefault: offpython/ruff

Reports a pass or ... statement in a body that has two statements or more.

pass and ... stand for “nothing here”. Next to other statements they only suggest that something was removed.

To fix, delete the statement.

Reported
...
x = a.startswith("a") and a.startswith("b")
x = a.startswith("a") or a.endswith("b")
if a:
pass
pass
else:
...
x = 1
def f():
"""doc"""
...
class C:
...
python:
lint:
rules:
unnecessary-placeholder: warn # off (default), warn, error

Enabled by the presets: python/ruff.

Suppress one line with sudsy-disable-next-line unnecessary-placeholder in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
ruff PIE790 full