A class derives from BaseException directly, so except Exception misses it

tx0/python:class-skips-exception-baserecommendedwarningsmell

What it finds

class ConfigError(BaseException):: BaseException is the root of the hierarchy and is meant for exceptions that end a program, such as SystemExit and KeyboardInterrupt. Handlers written as except Exception: do not catch a class derived from it directly, so it passes through code meant to handle all errors. Ordinary errors derive from Exception.

From the rule's source, class_skips_exception_base.rs.

Example from the rule's tests
class ConfigError(BaseException):tx0 reports: ConfigError derives from BaseException, so except Exception does not catch it    pass  class ParseError(Exception):    pass  class Shutdown(KeyboardInterrupt):    pass
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:class-skips-exception-base" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

# tx0: ignore[tx0/python:class-skips-exception-base] reason="..."

tx0 explain tx0/python:class-skips-exception-base shows the same in the terminal. Found a false positive? Report it.