reuse

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package reuse provides code reuse tracking and similarity detection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateGroup

type DuplicateGroup struct {
	Name     string   `json:"name"`
	Nodes    []string `json:"nodes"`
	Packages []string `json:"packages"`
}

DuplicateGroup represents nodes with identical or near-identical names.

type RefactorCandidate

type RefactorCandidate struct {
	Type        string   `json:"type"`
	Description string   `json:"description"`
	Nodes       []string `json:"nodes"`
	Suggestion  string   `json:"suggestion"`
	Priority    string   `json:"priority"` // high, medium, low
}

RefactorCandidate suggests potential refactoring opportunities.

type ReuseReport

type ReuseReport struct {
	SimilarGroups      []SimilarGroup      `json:"similar_groups"`
	DuplicateNames     []DuplicateGroup    `json:"duplicate_names"`
	SharedDeps         []SharedDepGroup    `json:"shared_dependencies"`
	RefactorCandidates []RefactorCandidate `json:"refactor_candidates"`
	Summary            ReuseSummary        `json:"summary"`
}

ReuseReport contains the analysis results.

type ReuseSummary

type ReuseSummary struct {
	TotalNodes         int `json:"total_nodes"`
	SimilarGroupCount  int `json:"similar_group_count"`
	DuplicateCount     int `json:"duplicate_count"`
	RefactorCandidates int `json:"refactor_candidates"`
}

ReuseSummary provides aggregate statistics.

type SharedDepGroup

type SharedDepGroup struct {
	SharedDeps []string `json:"shared_dependencies"`
	Nodes      []string `json:"nodes"`
	Count      int      `json:"dependency_count"`
}

SharedDepGroup represents nodes that share common dependencies.

type SimilarGroup

type SimilarGroup struct {
	Pattern     string   `json:"pattern"`
	Description string   `json:"description"`
	Nodes       []string `json:"nodes"`
	Similarity  float64  `json:"similarity"`
	Type        string   `json:"type"`
}

SimilarGroup represents nodes with similar signatures or structure.

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker identifies reusable code patterns and similar structures.

func NewTracker

func NewTracker(nodes []*graph.Node, edges []*graph.Edge) *Tracker

NewTracker creates a new reuse tracker.

func (*Tracker) Analyze

func (t *Tracker) Analyze() *ReuseReport

Analyze performs the reuse analysis.

Jump to

Keyboard shortcuts

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