Python docstring style checker for PEP 257 compliance
72
Build a focused docstring style checker that enforces whitespace, formatting, quote usage, and punctuation rules for Python docstrings. The checker should rely on the dependency to evaluate only the D2xx–D4xx rule family and present results through a callable API and a CLI entry point.
# noqa: D4xx comments suppress the corresponding violation when honor_noqa=True. @testhonor_noqa=False, so the same violation is emitted. @testinclude_source=True, each violation output includes the offending docstring lines beneath the message. @testinclude_count=True, the scan appends the total number of whitespace/formatting/quote/punctuation violations after the detailed messages. @test@generates
from typing import Sequence
def run_docstring_style_scan(
paths: Sequence[str],
*,
convention: str | None = None,
honor_noqa: bool = True,
include_source: bool = False,
include_explanations: bool = True,
include_count: bool = False,
) -> list[str]:
"""Return formatted violation messages for whitespace/formatting/quote/punctuation docstring rules (D2xx–D4xx) only."""
def main(argv: Sequence[str] | None = None) -> int:
"""CLI entry that accepts paths plus flags (--convention, --no-noqa, --source, --no-explain, --count) and exits 0 when clean, 1 when violations are found, and 2 on invalid options."""Docstring style checker providing whitespace, formatting, quote, and punctuation validation for the D2xx–D4xx rule family.
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