Documentation
¶
Index ¶
Constants ¶
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.
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.