Skip to content

Add remove_duplicates ignore_comments and merge_comments logic - #132

Merged
KatrinaHoffert merged 3 commits into
google:mainfrom
jakos-sec:remove-duplicates-comments
Aug 18, 2026
Merged

Add remove_duplicates ignore_comments and merge_comments logic#132
KatrinaHoffert merged 3 commits into
google:mainfrom
jakos-sec:remove-duplicates-comments

Conversation

@jakos-sec

Copy link
Copy Markdown
Contributor

Added DuplicateResolution enum to handle advanced deduplication modes. The new mores are ignore_comments to keep only the first comment for deduplicated items and merge_comments to merge comments from all identical items when deduplicated (identical comment lines are also deduplicated when merging).

Added `DuplicateResolution` enum to handle advanced deduplication modes.
The new mores are `ignore_comments` to keep only the first comment for deduplicated items and `merge_comments` to merge comments from all identical items when deduplicated (identical comment lines are also deduplicated when merging).
Comment thread keepsorted/block.go Outdated
Comment thread keepsorted/options.go
Comment thread keepsorted/options_parser.go Outdated

@wachsler-google wachsler-google left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry I don't have much experience with github reviews, so I posted a couple comments separate from this review before I figured out how this works. Anyway, this all looks pretty good, aside from the few things I've commented on.

- Use slices.Clone before deduplication loop when merging comments
- Rename remove_duplicates=ignore_comments to keep_first_comment everywhere
- Remove duplicate new line
- Add tests for remove_duplicates option parsing and resolution
@jakos-sec

Copy link
Copy Markdown
Contributor Author

Sorry I don't have much experience with github reviews, so I posted a couple comments separate from this review before I figured out how this works. Anyway, this all looks pretty good, aside from the few things I've commented on.

Feedback should be all addressed now. Thank you for the review!

Comment thread keepsorted/block.go Outdated
Comment thread goldens/duplicates_keep_first_comment.out
- In keep_first_comment mode, retain the first non-empty comment across duplicates if the initial occurrence has no comment
- In merge_comments mode, deduplicate merged comments at the comment-block level rather than line-by-line to preserve multi-line comments and paragraph breaks
- Add doc comments to DuplicateResolution in keepsorted/options.go
- Update golden tests and README documentation
@KatrinaHoffert
KatrinaHoffert dismissed wachsler-google’s stale review August 18, 2026 01:32

All comments were resolved. Dismissing rather than re-requesting review to avoid us doing extra reviews.

@KatrinaHoffert
KatrinaHoffert merged commit 35a0c8e into google:main Aug 18, 2026
11 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.

3 participants