Skip to content

Leave empty files out of the Stats duplicates and fold extension case - #174

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/172-stats-empty-files
Oct 7, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/172-stats-empty-files

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #172

What changed (Verbs/Stats.cs only)

  • Stats now builds its numbers from groups that pass Deduplicator.IsDeletable. Every other verb has used that set since Deduplicate deletes all but one empty file (__init__.py, .gitkeep, py.typed) while reclaiming 0 bytes #151. "Duplicate files", "Duplicate groups", "Wasted space", the extension breakdown and the largest-groups list now match what DryRun and Deduplicate would actually remove.
  • Copies in empty groups appear on their own line, Empty duplicates (never deleted): N. "Total files" still adds up: unique, plus duplicate, plus empty duplicates, plus unreadable.
  • Extensions are lower-cased before counting, so .JPG and .jpg copies fall under one .jpg line.

Tests (VerbOutputTests)

  • StatsLeavesEmptyFilesOutOfTheDuplicates uses the tree from the issue. Stats reports Duplicate files: 1, .jpg: 1 file(s), no .py line, no empty group in the largest list, and Empty duplicates (never deleted): 3. DryRun reports Files to delete: 1.
  • StatsCountsExtensionsThatDifferOnlyInCaseTogether: three mixed-case .jpg/.JPG pairs give one line, .jpg: 3 file(s).

With Stats.cs reverted, both new tests fail. With the change, the full suite passes locally: 81 passed, 3 skipped. The 3 skips already existed and need a non-root user. The existing Stats tests pass unchanged.

This PR is independent of #173 (the #140 fix); each branches from main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EMKbHPuiquQwvUr7NBWPvL


Generated by Claude Code

… [patch]

Empty files are never deleted, but Stats still counted every empty copy as
a duplicate, credited it to its extension and listed empty groups among
the largest, so a Python tree reported dozens of redundant __init__.py
files that DryRun would keep. Stats now counts only deletable groups and
reports empty copies on their own line, and .JPG and .jpg are counted as
one extension.

Fixes #172

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EMKbHPuiquQwvUr7NBWPvL
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit d88bb15 into main Oct 7, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/172-stats-empty-files branch October 7, 2026 05:34
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.

Stats counts empty files (__init__.py, .gitkeep) as duplicates and wasted copies that no verb will ever delete, so it disagrees with DryRun

2 participants