Skip to main content

Module dupes_grouping

Module dupes_grouping 

Source
Expand description

Per-group attribution for fallow dupes --group-by.

For each CloneGroup, every instance is attributed to a group key (owner, directory, package, or section) via the same OwnershipResolver used by check and health. The group itself is then attributed to its largest owner: the key with the most instances in that clone group. Ties are broken alphabetically (lexicographic ascending).

This mirrors jscpd’s majority-owner attribution and avoids the positional non-determinism that a “first-instance-wins” rule would introduce, since DuplicationReport::sort() already orders instances deterministically by file path then line.

Structs§

AttributedCloneGroup
A clone group annotated with its largest owner and per-instance owners.
AttributedInstance
A clone instance plus its per-instance owner key (for inline JSON / SARIF rendering).
DuplicationGroup
A single grouped duplication bucket.
DuplicationGrouping
Wrapper carrying the resolver mode label and grouped buckets.

Functions§

build_duplication_grouping
Build the grouped duplication payload from a project-level report.
largest_owner
Pick the largest owner for a clone group: most instances wins, ties broken alphabetically (smallest key wins).