Skip to content

strip-none-return

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.

rewrites it away.

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

rule enforces the other side of the convention, reporting where a parameter or a value-returning function lacks the annotation it owes.

Configuration

KeyTypeDefaultMeaning
enabledbooltrueToggles the rule on or off.

The Canonical Case

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()
python

More Examples

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.

No Change

A -> int | None and a -> Callable[..., None] keep their annotations untouched, because the rule strips only a return annotation that is a bare None.

No Change

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.

For per-line opt-outs, the Suppression chapter covers the # prose: skip[strip-none-return] directive.