更新技能:完善主工作流、面板UI规范与交付物核查脚本

This commit is contained in:
yi
2026-10-10 19:16:41 +08:00
parent 55478ce04a
commit 193cad407b
3 changed files with 41 additions and 11 deletions
+21 -6
View File
@@ -185,18 +185,33 @@ def main() -> int:
kws = [k.strip() for k in args.trace_keywords.split(",") if k.strip()]
traces: list[str] = []
if kws:
pat = re.compile("|".join(re.escape(k) for k in kws), re.I)
for p in iter_files(root):
if p.suffix.lower() not in SCAN_SUFFIXES:
# before/after 需要按独立词识别,避免 beforeEach、::before、::after 等代码语法误报。
exact_keywords = [k for k in kws if k.lower() not in {"before", "after"}]
exact_pat = (
re.compile("|".join(re.escape(k) for k in exact_keywords), re.I)
if exact_keywords else None
)
boundary_pats = {
"before": re.compile(r"(?<![A-Za-z_:-])before(?![A-Za-z_:-])", re.I),
"after": re.compile(r"(?<![A-Za-z_:-])after(?![A-Za-z_:-])", re.I),
}
active_boundary_pats = [
boundary_pats[k.lower()] for k in kws if k.lower() in boundary_pats
]
for file_path in iter_files(root):
if file_path.suffix.lower() not in SCAN_SUFFIXES:
continue
rel = str(p.relative_to(root))
rel = str(file_path.relative_to(root))
if re.search(r"license|copying", rel, re.I):
continue
try:
txt = p.read_text(encoding="utf-8", errors="ignore")
file_text = file_path.read_text(encoding="utf-8", errors="ignore")
except OSError:
continue
if pat.search(txt):
matched = bool(exact_pat and exact_pat.search(file_text))
if not matched:
matched = any(pat.search(file_text) for pat in active_boundary_pats)
if matched:
traces.append(rel)
if traces:
violations.append("痕迹清理不彻底,以下文件命中原标识关键词:%s" % "、".join(sorted(set(traces))[:20]))