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
+10
-2
@@ -96,6 +96,10 @@ enum Commands {
|
||||
/// Emit one JSON diagnostic per line on stdout (machine-readable; AI/MLSP 面)
|
||||
#[arg(long)]
|
||||
json: bool,
|
||||
|
||||
/// Also check prose above `>` calls (implicit occlusion; fuzzy, off by default)
|
||||
#[arg(long)]
|
||||
implicit_labels: bool,
|
||||
},
|
||||
/// Occlusion label queries: pending stubs (built-in words) or keyword search
|
||||
Labels {
|
||||
@@ -537,8 +541,12 @@ fn try_main(cli: Cli) -> Result<i32> {
|
||||
marqdo::run_file(&path, &opts)?;
|
||||
Ok(0)
|
||||
}
|
||||
Commands::Check { file, json } => {
|
||||
let diags = marqdo::check::check_path(&file)?;
|
||||
Commands::Check {
|
||||
file,
|
||||
json,
|
||||
implicit_labels,
|
||||
} => {
|
||||
let diags = marqdo::check::check_path_opts(&file, implicit_labels)?;
|
||||
let mut errors = 0i32;
|
||||
for d in &diags {
|
||||
if matches!(d.severity, marqdo::diagnostics::Severity::Error) {
|
||||
|
||||
Reference in new issue
Block a user