Several statements share one line, joined by ; or after the colon of a compound statement
What it finds
x = 1; y = 2 and if ready: start() put more than one statement on a line, which hides the second one from readers who scan the left edge, and from coverage tools that count lines. Stubs, where def f(): ... is the custom, and bodies that consist only of ... or pass are left alone.
From the rule's source, multiple_statements_per_line.rs.
import os; import systx0 reports: this statement shares its line with anotherif os.sep: print(1)tx0 reports: this statement shares its line with another class Empty: pass def stub(): ... for x in sys.argv: print(x) Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:multiple-statements-per-line" = "note"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:multiple-statements-per-line] reason="..."tx0 explain tx0/python:multiple-statements-per-line shows the same in the terminal. Found a false positive? Report it.