outdated-version-block
What it does
Section titled “What it does”Reports a test of sys.version_info against a version older than the target_version, or of sys.version_info[0] against a number.
Why it matters
Section titled “Why it matters”For the target version the answer of the test is always the same, so one of the branches never runs and the other needs no test. It is a block that was kept after support for the old version ended.
To fix, remove the test and keep the branch that runs.
Example
Section titled “Example”...
import sysif sys.version_info >= (3, 8): pass
from typing import TypeVar...Configuration
Section titled “Configuration”python: lint: rules: outdated-version-block: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line outdated-version-block 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 | UP036 |
full |