reassigned-constants
LintProse surfaces a UPPER_SNAKE_CASE casing.
A numbered-step comment inside a function body (# 1. ..., # Step 2: ...) is usually a signal that the function is doing too many things. Each numbered step wants to be its own helper with a name that captures what the step does, and the comment is standing in for that name.
Two shapes are recognized: the bare numeric-dot form # N. text and the Step-prefixed forms # Step N: text and # Step N. text (case-insensitive on the keyword). Inline comments at the end of a code line stay quiet, since they annotate the line rather than narrate a procedure. Pragma-style comments (# type: ignore, # noqa) stay quiet too, since they carry a different meaning. The lint fires at every scope (module-level, function body, class body, nested block) and never rewrites.
| Key | Type | Default | Meaning |
|---|---|---|---|
enabled | bool | true | Toggle the rule on or off |
A
# 1. normalize input
# 2. emit the result
def process(payload):
return payload.strip()
A numbered-step comment inside a class body is flagged the same way as one inside a function. The own-line filter passes and the enclosing
A run of numbered-step comments earns one # 1., # 2., and # Step 3: shapes all
A leading # 1. text comment matches the numeric-dot shape and earns a . and whitespace is the trigger.
A # fmt: off block carries the same
An end-of-line comment that happens to # 1. rides alongside its statement untouched.
A pragma comment routed through ruff_python_trivia::is_pragma_comment is invisible to the rule, even when its body opens with a digit or mimics another tool's directive shape. Lines like # noqa: F401 and # type: ignore pass through silently.
A module carrying no numbered-step comments produces no
Prose surfaces a UPPER_SNAKE_CASE casing.
Prose surfaces single-use local
For per-line opt-outs, the Suppression chapter covers the # prose: ignore[step-narration] directive.