A public function or method has no docstring
What it finds
A docstring says what a function does, what it expects and what it returns; help(), editors and documentation tools show it. Checked are functions and methods whose name and enclosing classes do not start with an underscore, at module level or in a class. Special methods such as __init__, overloads, property setters and deleters, and methods marked @override, which the documentation of the method they replace covers, are not checked, and neither are stubs and test files.
From the rule's source, undocumented_function.rs.
def load(path):tx0 reports: this public function has no docstring def helper(): pass return helper def save(path): """Save the file.""" def _internal(): pass class Reader: """Reads.""" def read(self):tx0 reports: this public function has no docstring pass def __init__(self): pass @overload def get(self, x: int) -> int: ... @value.setter def value(self, v): pass Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:undocumented-function" = "note"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:undocumented-function] reason="..."tx0 explain tx0/python:undocumented-function shows the same in the terminal. Found a false positive? Report it.