Skip to content

no-unnecessary-docstring

No docstring consumer detected — delete it; make author-controlled names, types, and structure explain the code.

Why

A docstring with no detected consumer makes code depend on prose for ordinary meaning and creates a second maintenance surface that agents expand and maintainers must review.

Fix

Delete the docstring. If author-controlled code is unclear without it, clarify names, types, and structure or extract a small named helper. Keep a genuinely hidden invariant as one concise local comment. When external tooling consumes __doc__, use an exact SARJ420 suppression that names the consumer.

Examples

Before — flagged Human-only module, class, and function prose
app/service.py
"""Service entry points."""
class Service:
"""Coordinates requests."""
def run(self) -> None:
"""Run the service."""
return None
After — preferred Framework consumes the function docstring
app/tools.py
from agents import function_tool
@function_tool
def lookup_account(account_id: str) -> str:
"""Look up an account for the model."""
return account_id