Documentation
¶
Overview ¶
Package gitdiff shells out to system git to compute which lines in which files a change touches. The result feeds diff-scoping in the engine — a gate finding on an untouched line is pre-existing noise, not a new bug.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotAGitRepo = errors.New("gauntlet: not a git repository")
ErrNotAGitRepo is returned when the target dir isn't a git worktree.
Functions ¶
Types ¶
type EmptyScope ¶
type EmptyScope struct{}
EmptyScope: no diff was computed (whole-tree mode). Everything is in-scope.
func (EmptyScope) Files ¶
func (EmptyScope) Files() []string
func (EmptyScope) IsScoped ¶
func (EmptyScope) IsScoped() bool
type FileChanges ¶
type FileChanges struct {
Path string
IsNew bool // added file — all findings on it count as new
IsBinary bool
Ranges []LineRange
}
FileChanges is what a diff produced for one file: touched line ranges on the new side, plus a flag for "this file is entirely new" (any line counts).
type LineRange ¶
type LineRange struct {
Start int // first changed line, 1-indexed
End int // last changed line, inclusive
}
LineRange is a half-open range on the new (+) side of a diff hunk. Start is 1-indexed. A rename-only file has zero ranges.
type Scope ¶
type Scope interface {
Includes(file string, line int) bool
IsScoped() bool // false for whole-tree; findings are never suppressed
Files() []string
}
Scope is the read-only interface the engine uses to ask "is this finding on a changed line?" ModeWholeTree returns an EmptyScope where every line is considered new.
func FromChanges ¶
func FromChanges(c map[string]FileChanges) Scope
FromChanges builds a Scope from a Compute result. Passing nil (whole-tree) returns EmptyScope.