checks.docs.DocsCheck
checks.docs.DocsCheck()Check for documentation presence and quality.
Verifies that the package has a README file and optionally checks that public modules, classes, and functions have docstrings, and that the project has documentation beyond the README.
Attributes
name :-
The check identifier (“docs”).
description :-
Human-readable description of this check.
rules :-
Every code the check can emit, with what the rule means.
hints :-
The same codes, with what to do about each finding.
README_FILENAMES :-
List of recognized README file names, most preferred first. Any other
README*name is found after them.
Examples
Run the docs check with defaults:
>>> from pathlib import Path
>>> check = DocsCheck()
>>> result = check.run(Path("."), {"enabled": True})
>>> result.name
'docs'Require half of the public items to have a docstring:
>>> config = {"enabled": True, "min_docstring_coverage": 50}
>>> result = check.run(Path("."), config)Methods
| Name | Description |
|---|---|
| run | Check documentation presence and quality. |
run
checks.docs.DocsCheck.run(package_path, config)Check documentation presence and quality.
Looks for a README file and optionally scans code for missing docstrings on public items and looks for documentation beyond the README.
Parameters
package_path : Path-
Path to the package directory to check.
config : dict[str, Any]-
Configuration dictionary with options: - require_readme (bool): Require README (default: True) - check_docstrings (bool): Check code docstrings (default: False) - check_readme_sections (bool): Look for installation and usage text in the README (default: False) - check_docs_site (bool): Look for documentation beyond the README (default: False) - min_docstring_coverage (float): Minimum coverage % (default: 0.0, disabled)
Returns
: CheckResult-
A CheckResult with:
: CheckResult-
- OK status if all documentation requirements met
: CheckResult-
- NOTE status if minor improvements suggested
: CheckResult-
- WARNING status if README missing (when required) or cannot be read
: CheckResult-
- SKIPPED status (“not-applicable”) if there is no README, none is required, no docstring was counted and no documentation beyond the README was looked for
: CheckResult-
- SKIPPED status (“parse-failed”) in that same case, if the docstring count was asked for and a sampled file could not be parsed