pub fn build_grouped_duplication_json(
report: &DuplicationReport,
grouping: &DuplicationGrouping,
root: &Path,
elapsed: Duration,
explain: bool,
) -> Result<Value, Error>Expand description
Build a grouped duplication JSON envelope when --group-by is active.
The envelope keeps the project-level duplication payload (stats,
clone_groups, clone_families) at the top level so consumers that ignore
grouping still see project-wide aggregates, and adds:
grouped_by: the resolver mode ("owner","directory","package","section").groups: one entry per resolver bucket. Each entry carries its own per-groupstats(dedup-aware, computed over the FULL group before--toptruncation),clone_groups(each tagged withprimary_ownerand per-instanceowner), andclone_families.
Paths inside groups are relativised the same way as the project-level
payload via strip_root_prefix.
ยงErrors
Returns an error if either the project report or any group cannot be serialised to JSON.