feat(check): M5 隐式遮蔽 — > 调用上方的叙述作为描述(默认关闭)
规则:`>` 调用上方的叙述段即其"描述";段内反引号实体必须被该调用用到,
或能解析到模块/内置,否则报 label.implicit_stale(warning)。
段落边界:紧邻上一行起,允许一个分隔空行(blockquote 前常空一行),
遇第二个空行/标题/代码行即止。
关键决策:**默认关闭(--implicit-labels 开启)**,依据是实测噪音:
- 初版(任何反引号都算断言):lib+ext/ai 上 6 条警告,**全为误报**
(`## open`、`{ path, kind }`、`source=`、`exec`/`net`)
- 加"实体名形状"过滤后:2 条
- 再加默认关闭:**0 条**
理由:描述一个调用可以用任意措辞,机械校验必然模糊;
默认开启就制造疲劳(违背 warning-fatigue-control)。这与 L1 不同:
L1 是"能证明才报",隐式检查是"可疑就报",必须 opt-in。
实体名过滤:首字符字母/_/非ASCII,其余字母数字/_/./非ASCII非空白
→ 排除 `## open` / `{ path, kind }` / `source=` / `path=`。
用法:marqdo check 文件 --implicit-labels
测试:3 个集成(默认静默 / opt-in 报不一致 / opt-in 对一致描述仍静默,
后两条是反向验证"不乱响");全量 593 passed / 0 failed(M6 后 590 + 3)。
文档:doc/design/change-m5-implicit-occlusion.md
This commit is contained in:
1 parent
6bba0be6d2
commit
409b8df2cb
7 files changed
+377
-3
No files matched your search
@@ -234,3 +234,46 @@ fn t1_session_summary_reports_counters() {
|
||||
assert!(summary.contains("\"labels_stale_seen\":1"), "{summary}");
|
||||
assert!(summary.contains("\"labels_outstanding\":1"), "{summary}");
|
||||
}
|
||||
|
||||
// ---- M5: implicit occlusion (prose above `>` calls) ----
|
||||
|
||||
#[test]
|
||||
fn implicit_labels_off_by_default() {
|
||||
let out = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
||||
.args(["check", "tests/occlusion/implicit-stale.mq.md"])
|
||||
.output()
|
||||
.expect("check");
|
||||
let text = String::from_utf8_lossy(&out.stdout).into_owned();
|
||||
assert!(
|
||||
!text.contains("调用上方的描述"),
|
||||
"must stay silent by default: {text}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn implicit_labels_opt_in_reports_mismatch() {
|
||||
let out = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
||||
.args([
|
||||
"check",
|
||||
"tests/occlusion/implicit-stale.mq.md",
|
||||
"--implicit-labels",
|
||||
])
|
||||
.output()
|
||||
.expect("check");
|
||||
let text = String::from_utf8_lossy(&out.stdout).into_owned();
|
||||
assert!(text.contains("调用上方的描述提到 `税率`"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn implicit_labels_opt_in_stays_quiet_when_consistent() {
|
||||
let out = Command::new(env!("CARGO_BIN_EXE_marqdo"))
|
||||
.args([
|
||||
"check",
|
||||
"tests/occlusion/implicit-ok.mq.md",
|
||||
"--implicit-labels",
|
||||
])
|
||||
.output()
|
||||
.expect("check");
|
||||
let text = String::from_utf8_lossy(&out.stdout).into_owned();
|
||||
assert!(!text.contains("调用上方的描述"), "{text}");
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: implicit occlusion consistent
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
按 `档位` 与 `金额` 计算应缴税额:
|
||||
|
||||
> 计税 档位=2 金额=100
|
||||
|
||||
## 计税
|
||||
+ `档位`
|
||||
+ `金额`
|
||||
|
||||
*`金额` * 0.1*
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: implicit occlusion stale
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
按 `税率` 与 `档位` 计算应缴税额:
|
||||
|
||||
> 计税 档位=2 金额=100
|
||||
|
||||
## 计税
|
||||
+ `档位`
|
||||
+ `金额`
|
||||
|
||||
*`金额` * 0.1*
|
||||
Reference in new issue
Block a user