missing-return-type¶
Part of: Enrichment Check
| Check | enrichment |
| Category | recommended |
| Applies to | functions, methods |
| Since | v1.14.0 |
Returns section has no type and function has no return annotation
What it detects¶
This rule flags functions and methods that document a return value (for example, a Google-style Returns: section or a Sphinx-style :returns:/:rtype: pair) but have no type information — neither a typed entry in the docstring (e.g., dict: The result. or :rtype: dict) nor a -> return annotation on the function signature.
Why is this a problem?¶
Without a documented return type, callers must read the implementation to determine what the function returns. API documentation generated by mkdocstrings will lack return type information, and IDE tooling cannot provide accurate type hints.
Either a typed Google-style Returns: entry, a Sphinx-style :rtype: directive, or a return annotation satisfies this check — all convey the return type to readers and tools.
How to Fix¶
Add a type to the Returns: entry:
Or add a return annotation to the function signature:
Either approach is sufficient — you don't need both.
Example¶
Exceptions¶
This rule is automatically skipped for:
__init__and__del__methods (constructors/destructors)@propertyand@cached_propertymethods- Functions without a
Returns:section (handled bymissing-returnsinstead) - NumPy-style underline
Returnssections (content extraction not yet supported)