docstring-missing-returns (DOC201)
Derived from the pydoclint linter.
This rule is unstable and in preview. The --preview
flag is required for use.
What it does
Checks for functions with explicit returns missing a "returns" section in their docstring.
Why is this bad?
Docstrings missing return sections are a sign of incomplete documentation or refactors.
This rule is not enforced for abstract methods, stubs functions, or
functions that only return None
.
Example
def calculate_speed(distance: float, time: float) -> float:
"""Calculate speed as distance divided by time.
Args:
distance: Distance traveled.
time: Time spent traveling.
"""
return distance / time
Use instead: