feat: -threshold filters diff findings by bytes saved#38
Merged
Conversation
-sort (default off) collects findings across all scanned packages and presents them largest-first by absolute bytes saved (OldSize-NewSize), using a stable sort so equal-savings structs keep source order and unknown-size findings sink to the bottom. Diff mode only for now; inspect support follows. Part of #30 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
In -inspect mode, -sort now collects all layouts across packages and orders them largest-first by Layout.Total (stable sort). Updates the flag help to cover both modes. Diff behavior unchanged. Closes #30 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
-threshold N (int, default 0, diff-only) drops findings that save fewer than N bytes. Negative values are treated as 0 (no filtering). The filter runs before sort and summary, so -summary counts only the kept structs and the exit code is 0 when everything is filtered out. Closes #31 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #38 +/- ##
========================================
Coverage ? 85.71%
========================================
Files ? 10
Lines ? 721
Branches ? 0
========================================
Hits ? 618
Misses ? 65
Partials ? 38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e7748d8 to
3f2d2fd
Compare
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.
Adds
-threshold N(int, default 0, diff-only): only show structs that save at least N bytes (inclusive). Negative values are treated as 0 (no filtering).The filter runs before sort/summary/exit, so:
-summarycounts only the structs that pass (verified by a test);-sort(filter, then sort).Reuses the
savings()helper. Tests cover the inclusive boundary (-threshold=16keeps the 16-byte saver, drops the 8-byte one),=0shows all, negatives behave like 0, all-filtered exits 0, and summary reflects the filtered set.task cigreen (96 tests).Closes #31
🤖 Generated with Claude Code