Python · maintainability
redundant-docstring
python:redundant-docstring Docstring only restates the signature — delete the whole docstring or document behavior callers cannot infer.
- Code
- SARJ050
- Default
- error
- Fix
- suggestion
- Languages
- python
Why
Restating a clear name and signature creates maintenance work without helping callers.
Fix
Delete the docstring or document behavior, constraints, side effects, or failure modes not evident from the signature.
Before / after
Executed by this rule’s unit tests.
Before
Docstring repeats the function name
def update_message(message_id: str):
"""Update the message."""
return None
After
Docstring documents behavior
def update_message(message_id: str):
"""Replace any existing draft atomically."""
return None
Limits
- Detection is limited to short docstrings whose words are already present in the function, class, annotations, or parameters.
- Framework-facing docstrings, generated files, directives, examples, references, and additional behavioral detail are excluded.