Python docstring style checker for PEP 257 compliance
72
A utility that scans Python modules to ensure every parameter in public callables is documented in the argument section of their docstrings for Google, NumPy, or Sphinx conventions.
bar is missing from the Args list, the check reports bar as undocumented for that function and returns a non-zero exit indicator. @testtimeout parameter, the check reports exactly that missing parameter and includes its line number. @testself or cls are not treated as undocumented even if absent from the docstring sections. @test@generates
from __future__ import annotations
from typing import Iterable, Literal, TypedDict, List
Docstyle = Literal["google", "numpy", "sphinx"]
class UndocumentedParam(TypedDict):
path: str
object: str
argument: str
line: int
source: str | None
class CoverageReport(TypedDict):
files_scanned: int
undocumented: List[UndocumentedParam]
exit_code: int
def check_argument_docs(paths: Iterable[str], style: Docstyle, *, include_source: bool = False) -> CoverageReport:
"""Analyze Python files and report parameters missing from docstring argument sections."""
def main(argv: list[str] | None = None) -> int:
"""CLI entry point that prints a human-readable report and returns the exit code."""Docstring style linter used to parse Google, NumPy, and Sphinx docstring sections and detect undocumented parameters.
Install with Tessl CLI
npx tessl i tessl/pypi-pep257evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10