double-negation
What it does
Section titled “What it does”Reports not not x.
Why it matters
Section titled “Why it matters”A double not turns a value into a bool, but the reader has to unwind two negations to see that. bool(x) says it, and in a condition the not not can be dropped.
To fix, write bool(x), or x where only the truth is needed.
Example
Section titled “Example”...x = not a < bx = not a == b == cx = not not a...x = 1 if a else 1......x = not a < bx = not a == b == cx = a...x = 1 if a else 1...Configuration
Section titled “Configuration”python: lint: rules: double-negation: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line double-negation 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 | SIM208 |
full |