history

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package history analyzes coupling/instability metrics across a sequence of git commits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

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

Analyzer analyzes metrics across git history.

func NewAnalyzer

func NewAnalyzer(
	repo *udagit.Repository,
	cache *cache.Cache,
	language string,
) *Analyzer

NewAnalyzer creates a new history analyzer.

func (*Analyzer) AnalyzeCommit

func (h *Analyzer) AnalyzeCommit(
	ctx context.Context,
	sha plumbing.Hash,
) (*CommitMetrics, error)

AnalyzeCommit analyzes a single commit and returns its metrics. Uses the cache if available.

func (*Analyzer) AnalyzeCommitFull

func (h *Analyzer) AnalyzeCommitFull(
	ctx context.Context,
	sha string,
) ([]LanguageMetrics, error)

AnalyzeCommitFull analyzes a commit and returns full metrics with dependency details. This is more expensive than AnalyzeCommit as it doesn't cache and returns full data.

func (*Analyzer) AnalyzeRange

func (h *Analyzer) AnalyzeRange(
	ctx context.Context,
	cr *udagit.CommitRange,
) ([]CommitMetrics, error)

AnalyzeRange analyzes a range of commits and returns metrics for each.

func (*Analyzer) CheckoutWorkspace

func (h *Analyzer) CheckoutWorkspace(sha string) (string, error)

CheckoutWorkspace ensures the workspace is checked out to the given SHA and returns the filesystem path to the workspace.

type CommitMetrics

type CommitMetrics struct {
	SHA       string                            `json:"sha"`
	Timestamp time.Time                         `json:"timestamp"`
	Message   string                            `json:"message"`
	Metrics   []analyzer.LanguageMetricsSummary `json:"metrics"`
}

CommitMetrics holds metrics for a single commit.

type LanguageMetrics

type LanguageMetrics struct {
	Language string             `json:"language"`
	Metrics  []analyzer.Metrics `json:"metrics"`
}

LanguageMetrics holds full metrics for a language, including detailed coupling stats.

type Workspace

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

Workspace manages a cloned copy of the repository for checkout operations.

func NewWorkspace

func NewWorkspace(originalRepo *udagit.Repository, workspacePath string) (*Workspace, error)

NewWorkspace creates a workspace by cloning the original repository to the given path. If the workspace already exists, it opens the existing clone.

func (*Workspace) Checkout

func (w *Workspace) Checkout(sha plumbing.Hash) error

Checkout checks out the given commit in the workspace.

func (*Workspace) FS

func (w *Workspace) FS() fs.FS

FS returns the workspace as an fs.FS for use with analyzers. Build and vendor directories are pruned via analysisfs so historical snapshots measure the same source surface as working-tree analysis.

func (*Workspace) Path

func (w *Workspace) Path() string

Path returns the filesystem path of the workspace.

Jump to

Keyboard shortcuts

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