missing-private-function-documentation (PDF609)¶
PDF608 missing-public-function-documentation
Next rule →PDF610 missing-public-method-documentation
Added in 1.0.0
Never fix
Requires explicit
Part of the PDF rule category.
View source · View documentation source · Search issues
Fix is not available.
Rule must by default be explicitly selected, unless it is removed from require-explicit.
What it does¶
Checks for private top-level functions that are missing docstrings.
A top-level function is private when its own name or containing module path is private.
Why is this useful?¶
Private functions can still benefit from local documentation when a project chooses to require it.
Ruff compatibility¶
None.
Examples¶
A private top-level function without a docstring is reported:
def _connect():
pass
PDF609: Line 1: Private function '_connect' is missing docstring
A public-looking function in a private module path is private:
def connect():
pass
PDF609: Line 1: Private function 'connect' is missing docstring
Async private top-level functions are checked the same way:
async def _connect():
pass
PDF609: Line 1: Private function '_connect' is missing docstring
A documented private top-level function is accepted:
def _connect():
"""Connect internally."""
Public top-level functions are handled by PDF608 instead:
def connect():
pass
Options¶
docstring-optional-function-decorators: Function decorator names that allow a private top-level function to omit a docstring.docstring-forbidden-function-decorators: Function decorator names that allow a private top-level function to omit a docstring because PDF616 reports docstrings on those definitions instead.
PDF608 missing-public-function-documentation
Next rule →PDF610 missing-public-method-documentation