-
Notifications
You must be signed in to change notification settings - Fork 0
Enforce docstring coverage in lint gates #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
73c76ba
Enforce docstring coverage in lint gates
leynos edb85d5
Bump template pyo3 to 0.29.0 to clear RUSTSEC-2026-0176
leynos a44bfed
Assert pytest-timeout in generated dependencies
leynos bb97f87
Document and test docstring lint gate
leynos 09daa09
Align Interrogate with Python targets
leynos fad9858
Complete Interrogate target documentation
leynos b766307
Avoid brittle Interrogate coverage assertion
leynos e73e853
Record Interrogate in quality gate ADR
leynos bfaf3f6
Use Python target variable in AGENTS lint docs
leynos 13d511a
Document Interrogate lint coverage
leynos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| """Validate rendered docstring coverage lint behaviour. | ||
|
|
||
| These integration tests render a project from the Copier template and exercise | ||
| its public ``make lint`` target instead of inspecting only generated text. They | ||
| prove that a clean render passes the full Python lint tier, then mutate the | ||
| rendered package to introduce a Ruff-clean missing private docstring and verify | ||
| that Interrogate fails the target. | ||
|
|
||
| The module protects the template contract that generated projects enforce 100% | ||
| docstring coverage through their normal lint workflow. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import re | ||
| import shutil | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
||
| from pytest_copier.plugin import CopierFixture | ||
|
|
||
| from tests.helpers.rendering import render_project | ||
|
|
||
|
|
||
| def test_generated_make_lint_enforces_interrogate_docstrings( | ||
| copier: CopierFixture, tmp_path: Path | ||
| ) -> None: | ||
| """Validate rendered ``make lint`` fails on missing private docstrings. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| copier : CopierFixture | ||
| Fixture used to render the template into a temporary project. | ||
| tmp_path : Path | ||
| Temporary directory used as the generated project root. | ||
|
|
||
| Returns | ||
| ------- | ||
| None | ||
| The test passes when a complete generated project passes ``make lint`` | ||
| and a private helper without a docstring fails at the Interrogate gate. | ||
| """ | ||
| package_name = "lint_docstrings_pkg" | ||
| project = render_project( | ||
| tmp_path / "lint-docstrings", | ||
| copier, | ||
| project_name="LintDocstrings", | ||
| package_name=package_name, | ||
| use_rust=False, | ||
| ) | ||
| make = shutil.which("make") | ||
| assert make is not None, "expected make to be available for generated tests" | ||
|
|
||
| passing_result = subprocess.run( | ||
| [make, "lint"], | ||
| cwd=project.path, | ||
| check=False, | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
| assert passing_result.returncode == 0, ( | ||
| f"expected generated make lint to pass with complete docstrings:\n" | ||
| f"{passing_result.stdout}\n{passing_result.stderr}" | ||
| ) | ||
|
|
||
| pure_module = project / package_name / "pure.py" | ||
| undocumented_helper = ( | ||
| '\n\ndef _missing_interrogate_docstring() -> str:\n return "undocumented"\n' | ||
| ) | ||
| pure_module.write_text( | ||
| pure_module.read_text(encoding="utf-8") + undocumented_helper, | ||
| encoding="utf-8", | ||
| ) | ||
|
|
||
| failing_result = subprocess.run( | ||
| [make, "lint"], | ||
| cwd=project.path, | ||
| check=False, | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
| output = f"{failing_result.stdout}\n{failing_result.stderr}" | ||
| assert failing_result.returncode != 0, ( | ||
| "expected generated make lint to fail when Interrogate finds a missing " | ||
| f"private docstring:\n{output}" | ||
| ) | ||
| assert "RESULT: FAILED" in output, ( | ||
| "expected generated make lint to run the Interrogate docstring gate" | ||
| ) | ||
| actual_match = re.search(r"actual:\s+([0-9]+(?:\.[0-9]+)?)%", output) | ||
| assert actual_match is not None, ( | ||
| f"expected Interrogate output to report actual docstring coverage:\n{output}" | ||
| ) | ||
| actual_coverage = float(actual_match.group(1)) | ||
| assert actual_coverage < 100.0, ( | ||
| "expected Interrogate output to report reduced docstring coverage" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.