合并 master(bde6b65e 注释标记词换代批): 判据出处注记标记词 # oracle:→# 判据出处: 与本批节锚改写合流——16 测试/探针文件取本批节锚内容+master 标记词(34 处节锚形态); test-conventions §8.3 取 master 换代措辞+补锚形态两档句; capability_audit.py CRITERION_RE 双形态(行号锚+节锚零空白兼容)+头注双形态说明。凭据: 能力审计单跑 红项0(判据出处注记函数 417 全识别)
This commit is contained in:
commit
3714e20b65
115 files changed
+772
-592
No files matched your search
+12
-12
@@ -16,8 +16,8 @@ r"""capability_audit.py — 能力清单、覆盖域表与 GDD 纯度机检(
|
||||
对上能力表里的行名;部分/未覆盖行的缺口非空且指待办清单。
|
||||
G 判据出处随测注记(test-conventions §8.3):game/tests/** 与 game/probe/** 内每个验证函数
|
||||
(函数体含 check(/check_quiet(/_problems.append(/push_error( 判定调用,定义行与 _check( 前缀除外)
|
||||
须带 ≥1 条 `# oracle: <design/相对路径>:<行号> <判据一句>` 注记(或节锚形态
|
||||
`# oracle: <design/相对路径>「节名」<关键词> <判据一句>`,2026-11-07 架构收窄批立,见
|
||||
须带 ≥1 条 `# 判据出处: <design/相对路径>:<行号> <判据一句>` 注记(或节锚形态
|
||||
`# 判据出处: <design/相对路径>「节名」<关键词> <判据一句>`,2026-11-07 架构收窄批立,见
|
||||
test-conventions §8.3);指针指向存在的设计文档行/节且不出
|
||||
design/ 全域。扫描面=game/tests/**+game/probe/**(sim/ 不进——测量面直构惯例)。
|
||||
条件闸行豁免(代表用例含「条件闸」字样)不参与 D/E。
|
||||
@@ -339,13 +339,13 @@ def check_coverage(cov_tables, names):
|
||||
red(README.relative_to(REPO), 1, "覆盖域表", "%s 未在覆盖域表登记" % doc)
|
||||
|
||||
|
||||
ORACLE_RE = re.compile(r"^#\s*oracle:\s*(\S+?\.md)(?::(\d+)|「([^」]+)」)\s*\S")
|
||||
CRITERION_RE = re.compile(r"^#\s*判据出处:\s*(\S+?\.md)(?::(\d+)|「([^」]+)」)\s*\S")
|
||||
VERDICT_RE = re.compile(r"(?<![_\w])check(?:_quiet)?\(|_problems\.append\(|push_error\(")
|
||||
ORACLE_FUNC_RE = re.compile(r"^(?:static\s+)?func\s+([A-Za-z_]\w*)")
|
||||
CRITERION_FUNC_RE = re.compile(r"^(?:static\s+)?func\s+([A-Za-z_]\w*)")
|
||||
|
||||
|
||||
def check_oracle_markers():
|
||||
"""判据出处随测注记机检(G 道):验证函数须带 # oracle 注记,指针可核。"""
|
||||
def check_criterion_markers():
|
||||
"""判据出处随测注记机检(G 道):验证函数须带 # 判据出处: 注记,指针可核。"""
|
||||
files = sorted((REPO / "game" / "tests").rglob("*.gd")) + sorted((REPO / "game" / "probe").glob("*.gd"))
|
||||
files = [p for p in files if p.name != "test_kit.gd" and p.name != "run_all.gd"]
|
||||
if not files:
|
||||
@@ -357,7 +357,7 @@ def check_oracle_markers():
|
||||
lines = read(p).splitlines()
|
||||
starts = []
|
||||
for i, ln in enumerate(lines):
|
||||
m = ORACLE_FUNC_RE.match(ln)
|
||||
m = CRITERION_FUNC_RE.match(ln)
|
||||
if m:
|
||||
starts.append((m.group(1), i))
|
||||
ranges = []
|
||||
@@ -381,11 +381,11 @@ def check_oracle_markers():
|
||||
for ln in body:
|
||||
st = ln.strip()
|
||||
if st.startswith("#"):
|
||||
m = ORACLE_RE.match(st)
|
||||
m = CRITERION_RE.match(st)
|
||||
if m:
|
||||
oks.append(m)
|
||||
if not oks:
|
||||
red(rel, s0 + 1, "判据出处注记", "验证函数 %s 缺 # oracle 注记" % name)
|
||||
red(rel, s0 + 1, "判据出处注记", "验证函数 %s 缺 # 判据出处: 注记" % name)
|
||||
flagged += 1
|
||||
continue
|
||||
marked += 1
|
||||
@@ -433,16 +433,16 @@ def main():
|
||||
names, referenced = check_capability_rows(cap_tables, suites, funcs, cards_corpus())
|
||||
missing_suites = check_suite_coverage(suites, referenced)
|
||||
check_coverage(cov_tables, names)
|
||||
oracle_marked, oracle_flagged = check_oracle_markers()
|
||||
criterion_marked, criterion_flagged = check_criterion_markers()
|
||||
|
||||
if selfcheck:
|
||||
print("capability_audit 扫描面异常:")
|
||||
for s in selfcheck:
|
||||
print(" ! " + s)
|
||||
|
||||
print("| ── 能力审计:系统文档 %d 篇 · 能力行 %d · 套件 %d · 覆盖域表 %d 行 · 链断套件 %d · oracle 注记函数 %d · 红项 %d"
|
||||
print("| ── 能力审计:系统文档 %d 篇 · 能力行 %d · 套件 %d · 覆盖域表 %d 行 · 链断套件 %d · 判据出处注记函数 %d · 红项 %d"
|
||||
% (len(system_docs()), len(names), len(suites),
|
||||
sum(len(r) for _, r in cov_tables), len(missing_suites), oracle_marked, len(reds)))
|
||||
sum(len(r) for _, r in cov_tables), len(missing_suites), criterion_marked, len(reds)))
|
||||
for path, line, check, msg in reds:
|
||||
print(" ✗ [%s] %s:%d %s" % (check, path, line, msg))
|
||||
if selfcheck:
|
||||
|
||||
Reference in new issue
Block a user