fix(cli): handle singular counts in scan summary - #102
Conversation
Add a plural helper for English pluralization and use it for findings, duplicate sets count in the scan summary, and the duplicate files header. Fixes Coding-Moves#99
Muawiya-contact
left a comment
There was a problem hiding this comment.
@vhmns14 Welcome, and thanks for picking this up! 🙌
This is exactly the shape I hoped for. The helper next to human_bytes is the right home, you caught all three call sites, and folding the existing ternary in print_findings into it means there's now one place to get this wrong instead of three.
Nice touch testing plural(0) — that's the case people forget.
Ran it here and approved CI: fmt, clippy and all 69 tests pass on Linux, macOS and Windows. The integration tests depend on where tempdir() lands, which differs on all three, so I wanted to see that go green before approving. It did.
Approving. If you fancy another, the issues here are labelled by difficulty — level: beginner is the small self-contained ones. Coding Moves has a few other repos too if Rust isn't your usual thing. And if you spot something off anywhere, opening an issue is just as welcome as a PR.
If you're enjoying the project, a ⭐ helps people find it. Hope to see you around 🚀
Description
Fixes #99.
Handles singular counts appropriately in
diskern scan:1 finding(singular) and1 duplicate set(singular) instead of1 findingsand1 duplicate sets.1 setinstead of1 sets.pluralhelper right belowhuman_bytesto keep call sites clean and consistent.Testing
pluralincrates/diskern-cli/src/main.rs.crates/diskern-cli/tests/singular_summary.rstesting single duplicate set and single finding scans.cargo test -p diskern-cli.cargo fmt --check.