GRM-45: fix: badge regex patterns and doc_coverage double-percent

Two issues caused coverage and docs badges to show "unknown":

1. Coverage regex expected decimal (100.00%) but pytest-cov outputs
   100% when coverage is exactly 100. Made decimal part optional.

2. doc_coverage.py passed pct="100%" to a template that already had
   %, producing (100%%). Removed the redundant % from the pct variable.
   Also relaxed the doc coverage regex to not require closing ).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Emil Simeonov
2026-06-22 00:43:22 +02:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent f5431c54cf
commit 28b4acf323
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ def main(docs_dir: str, fail_on_missing: bool) -> None:
"\nDoc coverage: {covered}/{total} ({pct}%)",
covered=covered,
total=total,
pct=f"{percentage:.0f}%",
pct=f"{percentage:.0f}",
)
)
+2 -2
View File
@@ -27,9 +27,9 @@ import click
REPO_ROOT = Path(__file__).resolve().parent.parent
INIT_FILE = REPO_ROOT / "src" / "gitea_runner_manager" / "__init__.py"
_COVERAGE_RE = re.compile(r"TOTAL.*?(\d+\.\d+)%$")
_COVERAGE_RE = re.compile(r"TOTAL.*?(\d+(?:\.\d+)?)%")
_PASSED_RE = re.compile(r"(\d+) passed")
_DOC_COVERAGE_RE = re.compile(r"Doc coverage:\s+\d+/\d+\s+\((\d+)%\)")
_DOC_COVERAGE_RE = re.compile(r"Doc coverage:\s+\d+/\d+\s+\((\d+)%")
def make_badge(label: str, message: str, color: str) -> dict[str, str | int]: