Represents a detected code clone — a group of structurally identical fragments.
Summary
Functions
Build a clone from a group of matching fragments.
Types
@type clone_type() :: :type_i | :type_ii | :type_iii
@type fragment_location() :: %{ file: String.t(), line: pos_integer(), ast: Macro.t(), mass: pos_integer() }
@type t() :: %ExDNA.Detection.Clone{ behaviour_suggestion: map() | nil, fragments: [fragment_location()], hash: binary() | nil, mass: pos_integer(), similarity: float() | nil, source_snippets: [String.t()], suggestion: map() | nil, type: clone_type() }
Functions
@spec from_fragments([map()], clone_type()) :: t()
Build a clone from a group of matching fragments.
Source snippets are computed eagerly since every surviving clone will have them accessed by reporters and stats.