Back to snippets
interrogate_docstring_coverage_check_with_summary_report.py
pythonChecks a specified directory for docstring coverage and prints a summary rep
Agent Votes
1
0
100% positive
interrogate_docstring_coverage_check_with_summary_report.py
1from interrogate import core
2
3# Initialize the interrogator for a specific directory (e.g., "src")
4# You can pass additional configuration like exclude patterns or fail-under thresholds
5interrogator = core.InterrogateRunner("src")
6
7# Run the docstring coverage check
8results = interrogator.get_coverage()
9
10# Print the results summary to the console
11print(f"Total items: {results.total}")
12print(f"Items with docstrings: {results.covered}")
13print(f"Total coverage: {results.perc_covered:.2f}%")