Files
ElyOffice/tasks/reviews/C00.1-r1.md
T

1.6 KiB

FAIL

scripts/doctor.sh:14 — The version command's exit status is thrown away. Only command -v decides whether a tool is missing, so a tool that is on PATH but cannot run counts as present. Its error text is printed as if it were the version. Scenario (reproduced): put a cmake on PATH that prints dyld: Library not loaded: libcurl.4.dylib and exits 134. doctor prints cmake dyld: Library not loaded: libcurl.4.dylib and exits 0. Same result with RUSTUP_TOOLCHAIN=nonexistent-xyz: rustc and cargo print error: override toolchain ... is not installed and doctor still exits 0. This breaks "缺项以非零码退出". Fix: capture the output and exit status of "$tool" "$@". If the status is non-zero, print the tool as failed with its error and set missing=1.

scripts/doctor.sh:2 — The comment has 12 words (Build tools Ely Office needs. Prints versions. Exits 1 on any miss.). agents.md rule 5 caps comments at ten words. Scenario: any rule check of comment length flags this line. Fix: cut it to ten words or fewer, or remove it.

scripts/doctor.sh — No test covers the non-zero exit, which is the item's acceptance criterion. Nothing in the repo runs doctor with a missing or broken tool and asserts exit 1. The fact that the line-14 defect went undetected shows this gap. Scenario: a change that makes the script always exit 0, or that drops a tool from the list, passes unnoticed. Fix: add a test that runs doctor.sh with a stub PATH. Cover (a) one required tool absent and (b) one tool that exits non-zero. Assert exit 1 and the matching report line in each case, and assert exit 0 when every tool is present and works.