Python docstring style checker for PEP 257 compliance
72
Build a small CLI that lints Python files while allowing callers to pick which docstring rules are applied through conventions and fine-grained rule filters.
pep257 convention and reports violations from that rule set when files break them. @test--select replaces the base rules with the provided comma-separated codes and --add-select appends extra codes; the combined list is deduplicated and sorted lexicographically. Violations are reported only for that final list. @test--ignore removes codes from either the convention defaults or the select list, and --add-ignore removes extra codes after additions. For example, --convention google --add-ignore D400 suppresses punctuation reports but still checks other Google rules. @test--show-selection prints the final rule codes (comma-separated, lexicographic order) before linting when any selection or ignore flags are used. @test@generates
from typing import List, Optional
def build_selection(
convention: Optional[str],
select: Optional[List[str]],
ignore: Optional[List[str]],
add_select: Optional[List[str]],
add_ignore: Optional[List[str]],
) -> List[str]:
"""Return the ordered rule codes after applying base convention, select override, additions, and ignores."""
def run_lint(paths: List[str], selection: List[str], show_selection: bool = False) -> int:
"""
Lint provided files or directories with the given rule selection, optionally printing the final codes.
Returns process-style status: 0 when no violations, 1 otherwise.
"""
def main(argv: Optional[List[str]] = None) -> int:
"""
CLI entrypoint that parses --convention, --select, --ignore, --add-select,
--add-ignore, --show-selection, and file/directory arguments, then runs linting.
"""Provides docstring linting with conventions and rule selection controls.
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