bare-raise-outside-handler
What it does
Section titled “What it does”Reports a raise with no exception in code that no except clause of its function contains.
Why it matters
Section titled “Why it matters”A bare raise re-raises the exception being handled. With no except around it, it fails with RuntimeError: No active exception to reraise, unless the function is only ever called from a handler, which nothing in the file shows.
To fix, raise a named exception, or move the raise into the except clause.
Example
Section titled “Example”...raise NotImplementedErrorraiseConfiguration
Section titled “Configuration”python: lint: rules: bare-raise-outside-handler: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line bare-raise-outside-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 | PLE0704 |
full |