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 is purely mechanical. It fires 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. 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
enabledbooltrueToggle 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.

python
def configure():
    load_settings()


def reset(state):
    state.clear()

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.

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