Skip to content

redundant-docstring

Function or plain-method docstring only repeats its declaration.

Why

Restating a clear name and signature creates maintenance work without helping callers.

Fix

Remove the restatement after confirming __doc__ is not an external contract. Clarify author-controlled names or types, and keep prose that documents constraints, side effects, or failure modes.

Examples

Before — flagged Function docstring only repeats its declaration
service.py
def update_message(message_id: str):
"""Update the message."""
return None
After — preferred Function docstring adds an atomicity guarantee
service.py
def update_message(message_id: str):
"""Replace any existing draft atomically."""
return None

Formerly: function-docstring-restates-declaration