Expand description
cargo xtask ci clippy-report — deduplicate clippy JSON artifacts and
report via reviewdog.
§How it fits into CI
The clippy matrix job runs cargo xtask clippy --save-json <file> for
every feature label on ubuntu-latest, uploading each file as a GitHub
Actions artifact. After the matrix completes, the clippy-report job
downloads all artifacts into a single directory and calls:
cargo xtask ci clippy-report --artifacts-dir <dir>This command reads every .json file in the directory, deduplicates
diagnostics across feature labels, and pipes the unique set through
reviewdog once — so each warning appears as exactly one PR review
comment regardless of how many feature combinations triggered it.
§Deduplication key
Two diagnostics are considered identical when they share the same
(file_name, line_start, message) triple taken from the primary span of the
clippy JSON message. Only diagnostic messages (compiler-message with spans)
are included; non-diagnostic JSON (build artifacts, build-finished, etc.)
is filtered out.
§Reviewdog
Uses the github-pr-review reporter. Requires:
reviewdogonPATHREVIEWDOG_GITHUB_API_TOKENset to a token withpull-requests: write
Structs§
- Clippy
Report Args - Arguments for
cargo xtask ci clippy-report.
Enums§
- Diagnostic
Key 🔒 - A key that uniquely identifies a clippy diagnostic for deduplication.
Functions§
- collect_
unique_ 🔒lines - Collects all JSON lines from every
.jsonfile indir, returning only the unique ones (deduplicated by primary span + message text). - diagnostic_
key 🔒 - Extracts a
DiagnosticKeyfrom a raw clippy JSON line. - find_
primary_ 🔒span - Extracts a primary span from clippy JSON diagnostic message.
- json_
files 🔒 - Returns sorted paths of every
.jsonfile directly insidedir. - json_
to_ 🔒short - Converts a clippy JSON line to short format for reviewdog.
- pipe_
to_ 🔒reviewdog - Spawns
reviewdogwith thegithub-pr-reviewreporter and writeslinesto its stdin. - run
- Reads all
.jsonfiles inartifacts_dir, deduplicates diagnostics, and pipes the unique set throughreviewdogusing thegithub-pr-reviewreporter.