if-tuple
What it does
Section titled “What it does”Reports an if or elif whose test is a tuple.
Why it matters
Section titled “Why it matters”A tuple with elements is always true (and an empty one always false), so the branch is always taken. It is usually a stray comma, or a condition written inside parentheses with commas instead of and.
To fix, write one boolean expression.
Example
Section titled “Example”x = y = 1if (x, y): passelif (x, y): passelif (x): pass...Configuration
Section titled “Configuration”python: lint: rules: if-tuple: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line if-tuple 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 | F634 |
full |