ci(pegasus): separate test and gate metrics
This commit is contained in:
parent
c841dfe824
commit
ed7af57d00
@ -25,6 +25,7 @@ from pathlib import Path
|
||||
SOURCE_SCAN_ROOTS = ("backend", "frontend/src", "scripts", "testing")
|
||||
SOURCE_EXTENSIONS = {".go", ".py", ".ts", ".tsx", ".sh"}
|
||||
QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"}
|
||||
STYLE_ISSUE_CHECKS = {"go-doc", "ts-doc", "go-vet", "tsc", "docs", "naming", "docs_naming", "hygiene", "lint"}
|
||||
|
||||
|
||||
def _escape_label(value: str) -> str:
|
||||
@ -197,6 +198,8 @@ def _count_source_files_over_limit(repo_root: Path, max_lines: int = 500) -> int
|
||||
continue
|
||||
if path.suffix not in SOURCE_EXTENSIONS:
|
||||
continue
|
||||
if path.name.endswith("_test.go") or path.name.endswith(".test.ts") or path.name.endswith(".test.tsx"):
|
||||
continue
|
||||
lines = len(path.read_text(encoding="utf-8", errors="ignore").splitlines())
|
||||
if lines > max_lines:
|
||||
count += 1
|
||||
@ -304,21 +307,24 @@ def main() -> int:
|
||||
gate_ok = bool(gate_summary.get("ok"))
|
||||
gate_issues = gate_summary.get("issues") or []
|
||||
source_lines_over_500 = _count_source_files_over_limit(repo_root, max_lines=500)
|
||||
outcome = (
|
||||
"ok"
|
||||
if gate_ok
|
||||
and backend_rc == 0
|
||||
issue_checks = {
|
||||
str(issue.get("check") or "").strip().lower()
|
||||
for issue in gate_issues
|
||||
if isinstance(issue, dict)
|
||||
}
|
||||
tests_ok = (
|
||||
backend_rc == 0
|
||||
and frontend_rc == 0
|
||||
and totals["tests"] > 0
|
||||
and totals["failures"] == 0
|
||||
and totals["errors"] == 0
|
||||
else "failed"
|
||||
)
|
||||
outcome = "ok" if gate_ok and tests_ok else "failed"
|
||||
checks = {
|
||||
"tests": "ok" if outcome == "ok" else "failed",
|
||||
"coverage": "ok" if coverage_pct >= 95.0 else "failed",
|
||||
"loc": "ok" if source_lines_over_500 == 0 else "failed",
|
||||
"docs_naming": "ok" if not gate_issues else "failed",
|
||||
"tests": "ok" if tests_ok else "failed",
|
||||
"coverage": "ok" if coverage_pct >= 95.0 and "coverage" not in issue_checks else "failed",
|
||||
"loc": "ok" if source_lines_over_500 == 0 and "loc" not in issue_checks else "failed",
|
||||
"docs_naming": "ok" if not (issue_checks & STYLE_ISSUE_CHECKS) else "failed",
|
||||
"gate_glue": "ok",
|
||||
"sonarqube": _sonarqube_check_status(build_dir),
|
||||
"supply_chain": _supply_chain_check_status(build_dir),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user