docs(问题记录): 删除项目审查与优化建议报告,结论并入模块文档与编号规范
用户裁定:该报告大部分内容已闭环,可删除;仍有价值的迁到合适文档。删前逐条核对, 确认绝大多数结论在仓内早已有权威副本(LV_DRAW_SW_COMPLEX / osFlagsNoClear / SPI 分频 8 / 分层反向依赖存量基线等),只迁真正独有的四类内容: 1. 暂缓理由与重开条件(三条量化门槛)→ RAM 使用分析与优化方案 §4,并明确「本节是唯一 权威」,其它文档只留指针;同时把 10 处指向报告 §5.3 的重开条件引用改指该节。 2. 2026-10-22「常驻 vs 动态」三项诊断(静态前五块 43,462 B = 58%;动态面只有 heap_4, 故栈余量=CCM 余量;栈深主因是日志/配置写链)→ 同文档 §2.5。 3. `_fp_digits` 1,018 B 删不掉的机理与 F-6 根因修法(Q10 宏改单精度,−332 B,4.49e6 例 逐位等价)→ §2.6.4。 4. 「UI 侧缓冲进 CCM」要按 DMA 可达性二分(LVGL 池可进,帧缓冲/推流缓冲不可)→ 暂缓清单。 编号侧(报告曾是 6 个族的属主登记处): - 原报告 §9 的 26 行「号 → 现在详述于」对照表迁到 docs/编号规范.md 新增 §4.5,6 族 owner_docs 改指该节。规范正文含大量写法示例,直接当定义集会误伤,故 check_ids.py 新增 `_def_owners`:snapshot_only 族剔除规范正文,只恢复可判定、不参与悬空/撞号/裸形 /紧邻判定(实测若不分,裸形 S1 误报 238 条、S-3 与登记簿 S-3 误判重复定义)。 - 11 个已死号(N-03b/N-10~N-13/N-20/N-21/N-24/N-26/S-1/S-2)在 id_aliases.json 登记 status=void 并写明去处——它们被约 110 处代码注释与文档引用,原先只靠「报告里顺带提过 一句」才算有定义,报告一删就集体悬空。N-21/S-1/S-2 一号两义,注记已分别标明。 - 顺带修 id_aliases.json 的 note 被脚本累积重复 26 次;修 registry 里 3 处仍指向改名前的 任务卡文件名(W1-采集保护收尾.md / W8-数据可信.md),以及 iec104_master.py 两处同类注释。 门禁:check_ids --strict 通过(可判定 8747/10410 = 84.02%,基线由 82.6% 抬到 84.0%); check_doc_links --all --sections-strict 通过(177 文档);pre-commit 相关钩子全过。
This commit is contained in:
+23
-16
@@ -141,6 +141,13 @@ class Checker(object):
|
||||
f["_re"] = re.compile(fam["pattern"])
|
||||
f["_full"] = re.compile("^(?:%s)$" % fam["pattern"])
|
||||
f["_owners"] = self._expand_owners(fam)
|
||||
# 定义集属主 ≠ 登记处属主。冻结历史快照族(snapshot_only)的登记处只能挂在
|
||||
# 规范正文(docs/编号规范.md §4.5 那种存档表)时,那张表**是存档不是定义**:
|
||||
# 规范里还混着大量写法示例(`N-99`、`S1`、`N-31`),若进定义集会同时打穿
|
||||
# 裸形判定(`S1` 被判成 `S-1` 的漏连字符,实测 238 条)与撞号判定(§4.5 的
|
||||
# `S-3` 与登记簿 S-3 被判重复定义)。因此只对快照族做这个剔除。
|
||||
f["_def_owners"] = ([o for o in f["_owners"] if o not in self.spec_docs]
|
||||
if fam.get("snapshot_only") else f["_owners"])
|
||||
f["_max"] = self._cursor_max(fam)
|
||||
self.families.append(f)
|
||||
# 长形态优先匹配:TC-UPPER 要先于 TC,避免大写后缀被当成合规
|
||||
@@ -210,7 +217,7 @@ class Checker(object):
|
||||
for rel in rels:
|
||||
self.read(rel)
|
||||
for fam in self.families:
|
||||
for owner in fam["_owners"]:
|
||||
for owner in fam["_def_owners"]:
|
||||
self.owner_docs.add(owner)
|
||||
self.owner_tokens[fam["name"]].update(
|
||||
m.group(0) for m in fam["_re"].finditer(self.read(owner)))
|
||||
@@ -298,7 +305,7 @@ class Checker(object):
|
||||
self._check_frozen(rel, lineno, literal, fam)
|
||||
self._check_dangling(rel, lineno, literal, fam)
|
||||
self._check_adjacent(rel, lineno, literal, fam, line, start)
|
||||
if rel not in fam["_owners"]:
|
||||
if rel not in fam["_def_owners"]:
|
||||
self.refs.setdefault(literal, set()).add(rel)
|
||||
|
||||
self._scan_malformed(rel, lineno, line)
|
||||
@@ -308,7 +315,7 @@ class Checker(object):
|
||||
if len(fams) == 1:
|
||||
return fams[0]
|
||||
for f in fams:
|
||||
if rel in f["_owners"]:
|
||||
if rel in f["_def_owners"]:
|
||||
return f
|
||||
for f in fams:
|
||||
if f.get("adjacent_required") and self._has_adjacent_cue(f, line, start):
|
||||
@@ -327,7 +334,7 @@ class Checker(object):
|
||||
if literal in self.owner_tokens[f["name"]]:
|
||||
return f
|
||||
for f in fams:
|
||||
if f.get("check_dangling") and f["_owners"]:
|
||||
if f.get("check_dangling") and f["_def_owners"]:
|
||||
return f
|
||||
for f in fams:
|
||||
if f["scope"] == "global":
|
||||
@@ -339,7 +346,7 @@ class Checker(object):
|
||||
for o in fam.get("owner_docs", []):
|
||||
stem = o.rsplit("/", 1)[-1]
|
||||
cues += [stem, stem.rsplit(".", 1)[0]]
|
||||
for o in fam["_owners"][:6]:
|
||||
for o in fam["_def_owners"][:6]:
|
||||
stem = o.rsplit("/", 1)[-1]
|
||||
cues += [stem, stem.rsplit(".", 1)[0]]
|
||||
out, seen = [], set()
|
||||
@@ -428,7 +435,7 @@ class Checker(object):
|
||||
def _check_frozen(self, rel, lineno, literal, fam):
|
||||
if not fam.get("frozen") or fam["_max"] is None:
|
||||
return
|
||||
if fam.get("cursor_owner_only") and rel not in fam["_owners"]:
|
||||
if fam.get("cursor_owner_only") and rel not in fam["_def_owners"]:
|
||||
# 裸形族(B5/C6/D7/M1/U3/R3/V5…)与位号、档位词、其它文档的同名清单大面积同形
|
||||
# (§1.2 五义/四义)→ 越游标只在属主登记处文档内判,文档外不判(见 unmanaged_bare)
|
||||
return
|
||||
@@ -442,7 +449,7 @@ class Checker(object):
|
||||
"该族已封闭,新条目改语义标识(§3.3);确需新号先改 docs/编号规范.md §4")
|
||||
|
||||
def _check_dangling(self, rel, lineno, literal, fam):
|
||||
if not fam.get("check_dangling") or not fam["_owners"] or rel in fam["_owners"]:
|
||||
if not fam.get("check_dangling") or not fam["_def_owners"] or rel in fam["_def_owners"]:
|
||||
return
|
||||
if rel in self.spec_docs:
|
||||
# 规范正文里的 `N-99`→`N-100`、`Trap 07` 这类是**写法示例**,不是引用
|
||||
@@ -463,14 +470,14 @@ class Checker(object):
|
||||
if base != literal and base in self.defined_all:
|
||||
self.stats["subitem_hits"] += 1
|
||||
return
|
||||
sev = fam.get("dangling_outside_owner", "error") if rel not in fam["_owners"] else "error"
|
||||
sev = fam.get("dangling_outside_owner", "error") if rel not in fam["_def_owners"] else "error"
|
||||
self.add(3, sev, rel, lineno, literal,
|
||||
"悬空引用:%s 在属主登记处(%s)查无定义,也不在别名表里(§8 校验 3)"
|
||||
% (literal, " / ".join(fam["_owners"][:2])),
|
||||
% (literal, " / ".join(fam["_def_owners"][:2])),
|
||||
"补定义行,或删引用(§5.5:销项 = 删行 + 清全库引用)")
|
||||
|
||||
def _check_adjacent(self, rel, lineno, literal, fam, line, start):
|
||||
if not fam.get("adjacent_required") or rel in fam["_owners"] or rel in self.spec_docs:
|
||||
if not fam.get("adjacent_required") or rel in fam["_def_owners"] or rel in self.spec_docs:
|
||||
return
|
||||
if "-" not in literal:
|
||||
# 只约束连字符形态的文档内编号:裸形(A2/B5/U3/D7)与位号、档位词大面积同形
|
||||
@@ -479,7 +486,7 @@ class Checker(object):
|
||||
if self._has_adjacent_cue(fam, line, start):
|
||||
return
|
||||
owner = fam["owner_docs"][0] if fam.get("owner_docs") else (
|
||||
fam["_owners"][0] if fam["_owners"] else "docs/<属主文档>.md")
|
||||
fam["_def_owners"][0] if fam["_def_owners"] else "docs/<属主文档>.md")
|
||||
self.add(6, "error", rel, lineno, literal,
|
||||
"文档内编号未紧邻文档名:%s 属「%s」,跨文档引用必须写全属主(§5.2 / §8 校验 6)"
|
||||
% (literal, fam["title"]),
|
||||
@@ -520,7 +527,7 @@ class Checker(object):
|
||||
allowed.add(frozenset((fam["class"], cw)))
|
||||
defs = defaultdict(list) # literal -> [(class, family_title, owner_doc)]
|
||||
for fam in self.families:
|
||||
for owner in fam["_owners"]:
|
||||
for owner in fam["_def_owners"]:
|
||||
for line in self.read(owner).splitlines():
|
||||
m = self.DEF_ANCHOR.match(line)
|
||||
if m and fam["_full"].match(m.group(1)):
|
||||
@@ -549,18 +556,18 @@ class Checker(object):
|
||||
|
||||
def check_orphans(self):
|
||||
for fam in self.families:
|
||||
if not fam.get("check_dangling") or not fam["_owners"]:
|
||||
if not fam.get("check_dangling") or not fam["_def_owners"]:
|
||||
continue
|
||||
if fam.get("allow_orphans"):
|
||||
# 属主登记处 = 代码的族(TC-HOST-*):号定义在测试函数上、本来就只在
|
||||
# 自己文件里出现,按"无人引用"报孤儿是纯噪音(118 条),显式声明不判
|
||||
continue
|
||||
for lit in sorted(self.owner_tokens[fam["name"]]):
|
||||
outside = {r for r in self.refs.get(lit, set()) if r not in fam["_owners"]}
|
||||
outside = {r for r in self.refs.get(lit, set()) if r not in fam["_def_owners"]}
|
||||
if not outside:
|
||||
self.add(7, "warn", fam["_owners"][0], 0, lit,
|
||||
self.add(7, "warn", fam["_def_owners"][0], 0, lit,
|
||||
"孤儿条目:%s 定义在 %s,全库无引用(§8 校验 7)"
|
||||
% (lit, fam["_owners"][0]),
|
||||
% (lit, fam["_def_owners"][0]),
|
||||
"确认已闭环可销项(§5.5),或补上引用")
|
||||
|
||||
# ---------- 报告 ----------
|
||||
|
||||
Reference in New Issue
Block a user