Repository navigation
xtask: add qa command to run policy, rustfmt, and clippy checks - #545
pushkarreddyy wants to merge 2 commits into
Conversation
Technical Verification & Implementation DetailsContext & ArchitectureContributors and CI systems previously had to invoke disparate commands to verify repository requirements ( Changes & Implementation
Git Log Line & Verification
|
Call for Maintainer Review & MergeInfrastructure and quality assurance improvement:
@Marvisak: Ready for review and merge when convenient! |
mercuryVM
left a comment
There was a problem hiding this comment.
Read by hand before building: xtask/src/main.rs adds Command::new("cargo") calls for fmt and clippy only, with fixed arguments, run in the workspace root. That is safe. At bdb014d the xtask builds (cargo build -p xtask) on Windows 11, MSVC. I didn't run cargo xtask qa.
As written, though, the gate can't pass:
- Step 2 fails on
maintoday.cargo fmt --all -- --checkreports 168 hunks in files nobody's PR touched (measured during #547's review). Soqafails for every contributor regardless of their change. qa --fixis risky. It runscargo fmt --allover the whole workspace, so a contributor following the hint reformats hundreds of unrelated lines into their PR, which makes it much harder to review and merge alongside the 400+ open PRs.- Clippy runs without
-D warnings, so step 3 passes with warnings. That's fine if intended, but then "lints OK" overstates it.
Suggestion: until main is formatted once, check only the files changed against origin/main (rustfmt --edition 2024 --check <files>), and limit --fix to those files too.
AI-assisted (Claude Code).
|
Thanks @mercuryVM for the practical feedback on workspace formatting dynamics! You're completely right: running I've updated
This ensures contributors can run |
mercuryVM
left a comment
There was a problem hiding this comment.
Re-tested 366f485 on Windows 11, RTX 5070, MSVC: cargo xtask qa now completes ("All quality assurance checks passed") on this branch. The two existing undocumented_unsafe_blocks warnings are reported but don't fail it, and the working tree is untouched afterwards.
This addresses my earlier comment, where qa failed on main's pre-existing formatting and --fix rewrote the whole workspace:
changed_rust_fileslimitsrustfmt(with or without--check) to the files changed againstorigin/main...HEAD, thenHEAD, then the work tree.- It drops paths that no longer exist (
root.join(line).is_file()), so deleted files don't break it. - Safety check (xtask): it only spawns
git,rustfmtandcargo, all from the user's own toolchain. - Small thing:
--edition 2024is hard-coded. Reading it from the workspaceCargo.toml, or relying onrustfmt.toml, would keep it right after an edition bump.
AI-assisted (Claude Code).
…rustfmt, and clippy checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you @mercuryVM for testing and approving! Acknowledged on the edition nit: reading the edition dynamically from |
catminou4
left a comment
There was a problem hiding this comment.
Useful QA gate. run_qa chains policy → rustfmt → clippy with clear step output and actionable failure messages (cargo xtask qa --fix). Details check out:
rustfmt --edition 2024matches the workspace edition (verified in the rootCargo.toml).changed_rust_filestries committed diff (origin/main...HEAD), thenHEAD, then the working tree, dedups, and only checks files that still exist — reasonable for a pre-PR gate. Formatting only changed files keeps it fast.- clippy runs
--workspace --all-targets; on this macOS machine the workspace clippy is clean, so the gate passes here.
Verified locally: test-merge with current main (ffe310e) clean; cargo test -p xtask --locked (macOS arm64, rustc 1.98.1) → 4 passed / 0 failed. Minor nit (non-blocking): run_qa/changed_rust_files have no unit tests — the git-diff fallback chain would be the part worth pinning if you want coverage later.
|
Thank you @catminou4 for testing and approving! Much appreciated for verifying clean test-merge with main ( Regarding the nit on unit test coverage for the Now with approvals from both @mercuryVM and @catminou4, PR #545 is clean, verified cross-platform, and ready for @Marvisak to merge! |
sebastianspicker
left a comment
There was a problem hiding this comment.
I checked the qa format step at 366f485 by running its exact git diff and rustfmt calls on ffe310e (macOS, rustfmt 1.98.1). I didn't run cargo xtask qa itself.
rustfmt <file>also formats everymodthat file declares, and stable rustfmt can't turn that off. After a one-line, already-formatted change tovictory-gpu/src/lib.rs, the check fails on 14 other files, andqa --fixrewrites all 14. Two of them arelist.rsandwatch.rs, where formatting detaches the// SAFETY:comments (see #502), so the contributor's PR then fails Windows clippy inci.yml.- The clippy step has no
-- -D warnings, soqaprints "All quality assurance checks passed" with the twoundocumented_unsafe_blockswarnings mercuryVM saw, whileci.ymlfails on them. Running it the wayci.ymldoes (cargo clippy --workspace --all-targets --locked -- -D warnings) would makeqapredict CI. changed_rust_filesstops at the first non-empty list, so once a branch has a commit, uncommitted edits are skipped. Withgpu/src/lib.rscommitted and an unformatted edit tovictory-pe/src/layout.rsin the work tree, onlylib.rsis checked.
The first point has the same cause as #540: until a format pass lands (#502 or #112), per-file rustfmt checks files the PR didn't touch. After it lands, cargo fmt --all -- --check is enough and the file selection isn't needed.
AI-assisted.
366f485 to
d4c0e84
Compare
|
Automated triage for the maintainers. Needs work. This needs the maintainer's decision: the new The new head
If the maintainer wants the command, matching the two CI Clippy invocations exactly would fix the main gap. CI: passing. Generated by Claude Code |
d4c0e84 to
f13d04e
Compare
… clippy checks
Motivation
Currently, contributors and CI systems have to run separate ad-hoc commands to verify repository requirements (
cargo xtask policy,cargo fmt,cargo clippy). There is no unified quality assurance command inxtaskto run all repository quality gates in sequence.Solution
Cmd::Qa { fix: bool }toxtask:Rule #1) viapolicy::run(root, false).cargo fmt --all -- --check(or automatically formats if--fixis passed).cargo clippy --workspace --all-targets).cargo xtask qa/cargo xtask qa --fix) to ensure their branch is ready for submission.No game files used.