xtask: check documented switches are read #3539
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3539"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by tharun-37 on 2026-11-27T15:39:19Z.
Adds
cargo xtask check-switchesand runs it from the pre-commit hook after the asset-policy check.The checker extracts concrete
VICTORY_*names fromREADME.mdanddocs/**/*.md, then verifies each is passed to an environment read in Rust source (var,var_os,switch::on,env!, and the existingenv_path/numbershelpers). Comments and writes such asset_varor.env(...)do not count. Wildcards and lowercase names are ignored, and duplicate doc mentions yield one diagnostic.The current tree passes with 29 documented names. Six synthetic tests cover direct reads, helpers, comments, writes, similar names, duplicate mentions, and line-number reporting. No game data, generated files, shader names or hashes are involved.
Verification:
cargo test -p xtask: 13 passed, 0 failed.cargo xtask check-switches: 29 names ok.cargo clippy --workspace --all-targets --locked -- -D warningspasses.cargo xtask policy: 192 files ok.victory-gpufailures.Claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7222166364
AI-assisted (OpenCode).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.