ci: 支援外部化底板觀測台檢查
All checks were successful
CD Pipeline / deploy (push) Successful in 1m11s

This commit is contained in:
OoO
2026-05-18 00:41:22 +08:00
parent ebc6f2cfe5
commit 3a779ca075
2 changed files with 12 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ CSS_PATH = Path("static/css/observability-system.css")
WEB_CSS_PATH = Path("web/static/css/observability-system.css")
SHELL_PATH = Path("templates/components/_ewoooc_shell.html")
BASE_PATH = Path("templates/ewoooc_base.html")
BASE_JS_PATH = Path("web/static/js/ewoooc-base.js")
ROUTE_PATH = Path("routes/admin_observability_routes.py")
@@ -286,9 +287,17 @@ def scan_base_topbar() -> list[str]:
return [f"{BASE_PATH}: missing required base/topbar file"]
text = path.read_text(encoding="utf-8")
findings = scan_required_snippets(BASE_PATH, REQUIRED_BASE_SNIPPETS, "base/topbar")
js_path = ROOT / BASE_JS_PATH
js_text = js_path.read_text(encoding="utf-8") if js_path.exists() else ""
combined_text = f"{text}\n{js_text}"
findings: list[str] = []
if not js_path.exists():
findings.append(f"{BASE_JS_PATH}: missing required base/topbar JS file")
for snippet in REQUIRED_BASE_SNIPPETS:
if snippet not in combined_text:
findings.append(f"{BASE_PATH}: missing required base/topbar snippet `{snippet}`")
for rule in FORBIDDEN_BASE_PATTERNS:
for match in rule.pattern.finditer(text):
for match in rule.pattern.finditer(combined_text):
line = line_number(text, match.start())
snippet = match.group(0).replace("\n", " ")[:90]
findings.append(