Skip to content

multiple-statements-on-one-line-colon

Pythonstyleno fixdefault: off

Reports a compound statement whose body starts on the line of its colon, as in if x: y(). def and a lone ... as the body are not reported.

The body is easy to miss when it sits at the end of a long line, and a line breakpoint or coverage mark on the line cannot tell the condition from the body.

To fix, put the body on its own indented line.

Reported
...
...
if x: pass
...
...
python:
lint:
rules:
multiple-statements-on-one-line-colon: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line multiple-statements-on-one-line-colon 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 E701 full