结构证据落库:新增 Tools/structcheck.ps1 + make structcheck(62/62)
背景
----
上一轮报告对「巨型实现文件按职责拆分」与「Components/Shared 共享控件」两件事只有散文描述,
缺少可复跑的证据。本提交把这两项结构约束写成入库脚本,任何人(或 CI)都能一键核验。
新增
----
- Tools/structcheck.ps1(入库,纯 ASCII,退出码 0/1):
[1] 拆分
* 16 个拆分产物必须存在且非空,并断言核心文件已显著变小
(PlotView.cpp 13 695 → 705 行;SignalPanel.cpp 4 184 → 1 019;
Application.cpp 3 135 → 1 326;DataModel.cpp 2 615 → 1 459);
* 12 组职责函数必须「只」定义在预期文件里
(PlotView::Paint/PaintLane/PaintHint → PlotViewPaint.cpp;
LaneAtY/CancelDrag → PlotViewInteraction.cpp;FitAll/SetHint → PlotViewFeatures.cpp;
Layout/BuildLaneVisuals → PlotView.cpp;SignalPanel::Paint/OnLButtonDown/EnsureRows → paint/interaction/core);
* 四个内部头必须声明具名命名空间并带 using-declaration,且把共享工具标 inline
(pvdetail 111 / spdetail 63 / appdetail 27 / dmdetail 4 个 inline 定义);
* 12 个拆分翻译单元必须真的被编译(Build/Release/*.o 齐全),并用 nm 断言
「绘制符号在 PlotViewPaint.o、PlotView.o 里一个都不剩」;
* 25 个实现文件所在目录必须全部登记在 Makefile;
[2] Components/Shared
* UiControls.hpp 声明 16 个控件,nm 断言这 16 个全部由 UiControls.o 定义(其他 .o 不是定义者);
* 69 处调用点必须跨 ≥3 个组件(实测 PlotView / SignalPanel / TabBar / Shared);
* 分层:Components/Shared 不含任何组件头;底层 Utilities/PaintUtil 不依赖 Shared;
Utilities 不含任何功能组件头。
- Makefile:新增 structcheck 目标(make structcheck)。
说明(脚本第一版的两个假失败,已修正判定)
------------------------------------------
1. 判定「控件定义」必须用 UiControls.hpp 里**声明**的名字,而不是「所有 Ui* 函数」:
UiFillRect / UiText / UiMeasureTextWidth 等是底层原语,本就住在 Utilities/PaintUtil。
2. 精确分层不变量是「Shared 不依赖任何组件;底层 PaintUtil 不依赖 Shared;
Utilities 不含功能组件头」,而不是「Utilities 一律不得依赖 Shared」:
Utilities/Src/{PopupMenu,ColorPickerPopup}.cpp 是历史上放在 Utilities 下的自绘 UI 小部件,
允许消费 Shared 控件(方向与各组件一致)。
文档
----
- Documents/refactor_report_2026-10-16.md:
* TL;DR 处更正首版「PlotView.cpp 整体拆分本轮未执行」的错误结论(那是提交 0871eb0 时刻的状态,
已被 e6b7bf6 推翻);
* §七 标题改为「遗留项与后续建议(逐项的最终处理状态)」;
* §9.4 验证表新增 make structcheck 62/62;
* 新增 §9.6「结构证据:把拆分与共享控件变成可复跑的检查」;
* §9.5 变更清单补充 Tools/structcheck.ps1 与 Makefile。
- Documents/agent_mem.md:
* §9.37 第七节补上可复跑证据与实测行数;
* §11.2 新增第 96 条(结构检查脚本的用法、两个易错判定、精确分层不变量);
* 变更日志 d2e6fdd 行补充 structcheck;
* 0871eb0 行的「未完成(已如实记录)」改为明确的「已由后续两个提交完成」。
验证
----
make release 零警告,Target.exe 764 416 B;
make structcheck 62/62;verify 49/49;datacheck 69/69;edgecheck 46/46;
panelanim 156/156;errcheck 19/19。
This commit is contained in:
1 parent
d2e6fdd085
commit
695b73a366
4 files changed
+268
-6
No files matched your search
@@ -188,6 +188,11 @@ debug: $(BUILD_DIR)/$(SUB_DIR_DEBUG)/$(TARGET_FILE_NAME).exe
|
||||
clean: $(BUILD_DIR)
|
||||
powershell rm -r $(BUILD_DIR)
|
||||
|
||||
# 结构检查任务:校验「巨型文件按职责拆分」与「Components/Shared 共享控件」两项结构约束
|
||||
# (需要先完成一次 release 构建,脚本会读取 Build/Release 下的目标文件)
|
||||
structcheck:
|
||||
powershell -ExecutionPolicy Bypass -File Tools/structcheck.ps1
|
||||
|
||||
# 构建目录生成
|
||||
$(BUILD_DIR):
|
||||
powershell mkdir $@
|
||||
|
||||
Reference in new issue
Block a user