movepurity

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const AnalyzerID = "commit-move-purity"

AnalyzerID is the stable ID this analyzer reports findings under, and the key its runtime params are looked up by - exported so the config projection in internal/analysis.withMovePurityParams spells it once.

View Source
const ParamMinSimilarity = "min_similarity"

ParamMinSimilarity is the params key config.MovePurityConfig.MinSimilarity is projected onto (see internal/analysis.withMovePurityParams) - the one place this name is spelled, instead of a string literal on both ends of the config-to-param hop.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

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

Analyzer reports staged renames that are not pure moves: a rename scored below the configured similarity, or renames staged alongside unrelated edits. Default severity is warning (raise via the "severity" param) because a high-similarity rename picking up an import fixup is common; the point is to nudge toward committing the move first, not abort it.

func NewAnalyzer

func NewAnalyzer(diffs diffReader) *Analyzer

NewAnalyzer creates a move-purity analyzer with the default similarity threshold. diffs may be nil (e.g. no repository is available), in which case the analyzer falls back to judging purity from git's own rename-similarity score alone: it cannot inspect a file's own diff, so every staged change outside a rename still counts as an edit.

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(ctx *core.AnalysisContext) []core.Finding

Analyze inspects the staged renames in ctx and reports the ones that are not pure moves, plus one finding when renames coexist with unrelated staged edits.

func (*Analyzer) ID

func (a *Analyzer) ID() string

func (*Analyzer) Stage

func (a *Analyzer) Stage() core.StageID

Jump to

Keyboard shortcuts

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