assert-false
What it does
Section titled “What it does”Reports an assert whose test is the literal False, with or without a message.
Why it matters
Section titled “Why it matters”assert statements are removed when Python runs with -O, so an assert False that is meant to stop the program does nothing there and execution goes on past the line.
To fix, write raise AssertionError(...), which always runs.
Example
Section titled “Example”... pass
assert Falseassert False, "message"assert 0...getattr(x, "__private")...Configuration
Section titled “Configuration”python: lint: rules: assert-false: warn # off, warn (default), errorSuppress one line with sudsy-disable-next-line assert-false in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | B011 |
full |