clone

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package clone holds the neutral value types for clone-detection results so that core-ring packages (e.g. internal/metrics) can consume them without importing an adapter under internal/extract. The clone-detection adapter (internal/extract/clones) produces these; metrics reads them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModulePairs

func ModulePairs(clusters []Cluster, key func(string) string) [][2]string

ModulePairs converts a slice of Clusters to canonical cross-module pairs using an injected key function. Same-module pairs are skipped. Each pair is returned in sorted order ([a,b] where a <= b) and the result slice is deduped and sorted for determinism.

The key function is typically fileToModuleKey(file, lang) from the metrics package, injected at the call site so this package stays free of that import.

Types

type Cluster

type Cluster struct {
	// Files contains the repo-relative (or absolute) paths involved in the clone.
	Files []string
	// Lines is the number of duplicated lines in the block.
	Lines int
}

Cluster represents a group of files that share a duplicated code block.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL