Skip to content

fix(cli): handle singular counts in scan summary - #102

Merged
Muawiya-contact merged 1 commit into
Coding-Moves:mainfrom
vhmns14:fix/singular-scan-summary
Sep 7, 2026
Merged

fix(cli): handle singular counts in scan summary#102
Muawiya-contact merged 1 commit into
Coding-Moves:mainfrom
vhmns14:fix/singular-scan-summary

Conversation

@vhmns14

@vhmns14 vhmns14 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #99.

Handles singular counts appropriately in diskern scan:

  • Summary headline now outputs 1 finding (singular) and 1 duplicate set (singular) instead of 1 findings and 1 duplicate sets.
  • Duplicate files section now outputs 1 set instead of 1 sets.
  • Added a plural helper right below human_bytes to keep call sites clean and consistent.

Testing

  • Added unit test for plural in crates/diskern-cli/src/main.rs.
  • Added regression integration tests in crates/diskern-cli/tests/singular_summary.rs testing single duplicate set and single finding scans.
  • Verified all tests pass with cargo test -p diskern-cli.
  • Verified formatting with cargo fmt --check.

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 Muawiya-contact left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 🚀

@Muawiya-contact
Muawiya-contact merged commit db56b0b into Coding-Moves:main Sep 7, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diskern scan prints "1 duplicate sets" and "1 findings"

2 participants