Repository navigation
Count each duplicate under its own extension in Stats [patch] - #168
Merged
Merged
Conversation
The extension breakdown credited a whole group to the extension of Files[0], which included the copy that is kept and was whichever copy the parallel hash listed first. Mixed-extension duplicates landed under one extension that changed between runs, and the totals exceeded "Duplicate files". Each redundant copy is now counted under its own extension, the keeper is left out, and ties are ordered by extension so the output is stable. Fixes #146 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q5ZFyLG9PgeKn5RpzhWEUQ
Brings Stats.Run back under SonarCloud's cognitive complexity limit (S3776). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q5ZFyLG9PgeKn5RpzhWEUQ
Addresses the code-quality review on this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q5ZFyLG9PgeKn5RpzhWEUQ
# Conflicts: # FileDeduplicator.Test/VerbOutputTests.cs
|
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.



Fixes #146
What changed
The "Duplicate files by extension" breakdown in
Statscredited each whole group to the extension ofgroup.Files[0]. That caused three problems:Files[0]is whichever copy the parallel hash happened to list first.Now each copy other than
Deduplicator.SelectFileToKeep's keeper is counted under its own extension. Rows with equal counts are ordered by extension, so the output is the same on every run.Tests
VerbOutputTests.StatsBreaksDuplicatesDownByEachCopysOwnExtension. It runs Stats three times onphoto.jpg,photo-copy.pngandbackup.bak, all with identical content. Every run reportsDuplicate files: 2, a breakdown of.bak: 1and.png: 1, and no.jpgrow, sincephoto.jpgis the keeper. With theStats.cschange reverted, this test fails.StatsReportsTotalsForTheTree. It asserted.txt: 3 file(s)alongsideDuplicate files: 2, which is exactly the inconsistency the issue describes. It now expects.txt: 2 file(s).The full suite passes: 60 passed, 2 pre-existing skips.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q5ZFyLG9PgeKn5RpzhWEUQ
Generated by Claude Code