parameter-type-required (PDF701)¶
PDF700 parameter-missing-description
Next rule →PDF702 parameter-type-forbidden
Part of the PDF rule category.
View source · View documentation source · Search issues
Fix is not available.
Rule is disabled if docstring-convention is none or pep257, and ignored by broad selectors under google, numpy, and rest.
Rule is incompatible with PDF702.
What it does¶
Checks that parsed parameter entries in owning function docstrings include a documented type.
Only entries that match real signature parameters are checked. The rule is exact opt-in because many projects rely on code annotations instead of repeating parameter types in docstrings.
Why is this useful?¶
Projects that keep types in docstrings can enforce complete parameter type documentation.
Ruff compatibility¶
None.
Examples¶
PDF701 reports matching parameter entries without docstring types:
docstring-convention = "google"
def function(value: int, timeout: float):
"""Connect to the service.
Args:
value: Endpoint identifier.
timeout (float): Timeout in seconds.
"""
PDF701: Line 5: Function parameter 'value' docstring entry is missing a type
Google and NumPy entries with types are accepted:
docstring-convention = "numpy"
def function(value: int, timeout: float):
"""Connect to the service.
Parameters
----------
value : int
Endpoint identifier.
timeout : float
Timeout in seconds.
"""
reST :type: fields provide the type even when the value field contains only prose:
docstring-convention = "rest"
def function(value: int):
"""Connect to the service.
:param value: Endpoint identifier.
:type value: int
"""
Options¶
None.
PDF700 parameter-missing-description
Next rule →PDF702 parameter-type-forbidden