redundant-tuple-in-exception-handler
What it does
Section titled “What it does”Reports an except clause that names a tuple of one exception, except (E,):.
Why it matters
Section titled “Why it matters”The parentheses and comma make a tuple for no reason, and a reader looks for the other exceptions that are missing.
To fix, write except E:.
Example
Section titled “Example”...zip(a, b, strict=True)try: passexcept (ValueError,): passexcept (ValueError, TypeError): passConfiguration
Section titled “Configuration”python: lint: rules: redundant-tuple-in-exception-handler: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line redundant-tuple-in-exception-handler 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 | B013 |
full |