Skip to content

no-docstring-type-restatement

A docstring type label repeats an annotation from the fully typed signature.

Why

A repeated type spelling can drift from the annotation and obscures the behavioral contract that only prose can express.

Fix

Remove only the redundant type label. Keep behavioral meaning, units, defaults, constraints, and raised-error conditions in the docstring.

Examples

Before — flagged Remove only the repeated type label
app.py
def decode(payload: str) -> dict[str, object]:
"""Decode the payload.
Args:
payload (str): UTF-8 JSON; duplicate keys are rejected.
"""
return {}
After — preferred Argument section records behavior
app.py
def decode(payload: str) -> dict[str, object]:
"""Decode the payload.
Args:
payload: UTF-8 JSON; duplicate keys are rejected.
"""
return {}

Formerly: no-typed-doc-sections