Repository navigation
Show every finding of a lint in a file that is over its baseline - #30
Merged
alii merged 1 commit intoSep 22, 2026
Merged
Conversation
The baseline holds a count for a lint and a file, not which findings. A run hid the first N findings in the file and printed the rest, so a new finding written above the old ones was hidden and an old one was printed in its place. On oven-sh/bun#43728 the baseline allowed three `generic_body_not_generic` findings in node_fs.rs, the change added a fourth, and the run named `readdir_with_entries_recursive_async`, which the change did not touch. A file that goes over now shows every finding of that lint, each with the note that names the recorded count, and one line after them with both counts and the reason: any of the findings can be the new one. A file within its count still prints nothing. Whether a file is over is known once the crate is done, so the driver builds each finding and holds it, as a `DiagInner`, until `BaselineWriter::check_crate_post`, and prints all of a key's findings or none. `cargo mordant` does the same for `unused_pub`, where it has every finding at hand already. What `over-baseline.txt` and the closing line per crate count is unchanged: the findings past the recorded count.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
mordant-baseline.tomlholds a count of allowed findings for each lint and file, not which findings. When a file had more findings than its count, a run hid the first N in file order and printed the rest.generic_body_not_genericfindings innode_fs.rs, the change added a fourth (UVFSRequest::run_from_js_thread, Windows only), and the CI annotation namedreaddir_with_entries_recursive_asyncatnode_fs.rs:6446, which is not in that change's diff.Fix
A file that goes over shows every finding of that lint. Each one has the note with the recorded count, as before. One line follows them with both counts and the reason:
A file within its count still prints nothing.
over-baseline.txtand the closing line per crate do not change. They count the findings past the recorded count, not the findings shown.In the driver, whether a file is over is known only once the crate is done.
weighno longer decides per finding. Each finding is built at once, kept as an ownedDiagInner(theDiagitself borrows the session and is cancelled), andBaselineWriter::check_crate_postprints all of a key's findings or none. They are printed by position, because a lint that reports at the end of the crate has an order of its own.cargo mordantdoes the same forunused_pub, where it already has every finding at hand. Both usebaseline_file::over_messagefor the line with the counts.Tests
a_file_over_the_baseline_shows_every_finding_of_the_lint. It records onediscarded_error, then adds a second one above it. Without the change the run prints line 10, the old finding, and not line 6, the new one.unused_pub_is_held_to_the_baselinenow adds the new item above the recorded one and expects both. Without the change it printsdemo::oldonly.cargo fmt --check,cargo test,cargo clippy --all-targets -- -D warnings, and mordant over itself with-D warningspass.Checked over oven-sh/bun
over-baseline.txt.generic_body_not_generic:src/runtime/node/node_fs.rslowered from 3 to 2, the run prints all three findings in that file (CpSingleTask::create,mkdir_recursive_os_path_impl,readdir_with_entries_recursive_async), then the line with "3 ... findings" and "allows 2", andover-baseline.txtgetsbun_runtime 1.Cost
derived_fieldfindings for one file. That is the price of a baseline that counts: it cannot name the new one.