Skip to content

core/clone: split groups along the retained pairs #173

Description

@DaisukeYoda

Clone groups are formed before some pairs are dropped. Suppressed members take their pairs with them, and the clone-type filter removes whole pair types. A group that only held together through a dropped pair must be split into the connected components of the remaining pairs, and its type and similarity must be recomputed from them.

pyscn implements this twice: splitDisconnectedGroups in internal/analyzer/clone_detector.go (69f577b) and filterCloneGroupsByPairs in service/clone_group_filter.go (cf077e1, fc35b60). jscan now has one generic helper, analyzer.SplitGroupsByPairs in polyscan/internal/js/analyzer/clone_group_split.go, which both its detector and its clone service call.

The operation is language-independent and belongs next to FilterGroupsWithoutBackingPairs in core/clone. Moving it there needs a core tag, after which jscan and pyscn can both drop their local copies.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions