mirror of
https://github.com/Mudlet/Mudlet
synced 2026-08-13 18:26:27 -04:00
#### Brief overview of PR changes/additions Follow-up to #9508. Hardens `cmake/audit-core-widgets.sh` against five silent-wrong-count failure modes (each reproduced by running the script against crafted inputs), and refreshes the committed baseline/report to the current count. - **CMakeLists parser** now strips `#` comments and a trailing `\r`, and tracks multi-line `list(APPEND mudlet_SRCS ...)` blocks. Previously a `)` inside a comment truncated the file list, a commented-out filename got audited, a wrapped `APPEND` dropped its continuation lines, and a CRLF checkout only partially parsed. - **Comment/string stripper** now matches a `/* ... */` comment whose body contains `*` (the `/** ... */` one-liner that used to latch the scanner into comment mode and silently swallow the rest of a file), and hard-fails (exit 2) on an unterminated comment at EOF rather than under-counting. - **`--enforce`** is now a real gate: a source file listed in `CMakeLists.txt` but missing from disk is fatal, and the baseline is strict-parsed (bare integer on line 1). The old `tr -cd 0-9` pooled every digit in the file, so a `# updated 2026-07-20` comment produced a baseline like `20260720158` that out-ranked any real count and passed forever. - **Qt sanity**: if the `QtGui`/`QtCore` header listings come out empty while `QtWidgets` is non-empty (a partial/broken Qt), the script aborts instead of miscounting relocated forwarder headers (`qaction.h`, `qshortcut.h`, ...) as Widgets dependencies. - **Baseline + report refreshed** from `160` to `158`: #9507 decoupled the telnet engine from UI dialogs after the original report was generated, so `ctelnet.cpp`/`ctelnet.h` are now clean. The script stays POSIX `sh`, deterministic (`LC_ALL=C`), and fast (~0.2s). The parser change is count-neutral: old and new parsers produce an identical 392-file list on the current `src/CMakeLists.txt`. #### Motivation for adding to Mudlet The audit becomes a CI gate once the count reaches 0 (#8681, #9011). Before that, it must never report a wrong number quietly - every one of these paths could have made the count drift (up or down) with no visible error, which would erode trust in the gate. Loud failure beats a silently passing check. #### Other info (issues closed, discussion etc) Follow-up to #9508. No build required (shell + docs only). Self-tested with a 17-assertion harness that crafts each proven failure input and confirms the fixed script returns the correct count or exits 2, while the pre-fix script mis-parses. **Test case:** ``` bash cmake/audit-core-widgets.sh --summary # expected: mudlet_core Qt Widgets audit: 158 of 392 files depend on Qt Widgets bash cmake/audit-core-widgets.sh --enforce # expected: mudlet_core Qt Widgets audit: 158 offending files (baseline 158). (exit 0) ``` Assisted-by: Claude:claude-opus-4-8 |
||
|---|---|---|
| .. | ||
| audit-core-widgets.sh | ||
| core-widgets-baseline.txt | ||
| FindHUNSPELL.cmake | ||
| FindLua51.cmake | ||
| FindONIGURUMA.cmake | ||
| FindPCRE.cmake | ||
| FindPCRE2.cmake | ||
| FindPUGIXML.cmake | ||
| FindSparkle.cmake | ||
| FindYAJL.cmake | ||
| FindZIP.cmake | ||
| FindZZIPLIB.cmake | ||
| IncludeOptionalModule.cmake | ||
| InitGitSubmodule.cmake | ||
| StaticAnalysis.cmake | ||