signature-annotations
LintFlags a signature parameter or a value-returning function that carries no type annotation.
A written -> None on a function that returns nothing is visual weight the signature does not need. The omission convention already reads an absent return annotation as a function that returns nothing, leaving the explicit form as noise rather than information.
The rewrite stays purely mechanical, firing only when the return annotation is a bare None, leaving a None nested inside a larger annotation (int | None, Callable[..., None]) and every parameter annotation untouched. A declaration-only stub keeps its -> None too, because a lone ... body (an @overload arm, a Protocol method, an abstract method) is a placeholder whose -> None declares a type-checker contract rather than redundant weight. The companion
| Key | Type | Default | Meaning |
|---|---|---|---|
enabled | bool | true | Toggles the rule on or off. |
An explicit -> None return annotation strips away, since an omitted return annotation already reads as a function that returns nothing.
def configure():
load_settings()
def reset(state):
state.clear()
A -> (None) return annotation drops its wrapping parentheses along with the arrow, since the strip reaches the parenthesized form as readily as the bare one.
An async def and an __init__ method each lose their redundant -> None return annotation, the strip reaching every function shape uniformly.
A -> int | None and a -> Callable[..., None] keep their annotations untouched, because the rule strips only a return annotation that is a bare None.
An @overload arm whose body is a single ... keeps its -> None, because the placeholder declares the type-checker contract rather than a redundant annotation. Stripping it would leave one arm declaring no return beside an arm that declares str.
Flags a signature parameter or a value-returning function that carries no type annotation.
Normalizes function signatures to one line or one parameter per line, gated by line length and inline-parameter count.
Removes from __future__ import annotations lines that no longer carry their weight on the target Python version.
For per-line opt-outs, the Suppression chapter covers the # prose: skip[strip-none-return] directive.