changed

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: 0BSD Imports: 18 Imported by: 0

Documentation

Overview

Package changed resolves source lines owned by a Git change relative to a deterministic merge base.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineRange

type LineRange struct {
	Start int
	End   int
}

LineRange is one inclusive one-based physical line interval.

type Scope

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

Scope is one immutable repository change relative to a resolved merge base.

func Resolve

func Resolve(ctx context.Context, anchor, base string) (*Scope, error)

Resolve discovers the containing Git repository and computes current source lines changed since the merge base shared by base and HEAD.

func (*Scope) Changed

func (s *Scope) Changed(path string) bool

Changed reports whether path is a current changed or untracked path.

func (*Scope) Contains

func (s *Scope) Contains(path string) bool

Contains reports whether path resolves within the repository root.

func (*Scope) FilterDiagnostics

func (s *Scope) FilterDiagnostics(
	file *source.File,
	diagnostics []rules.Diagnostic,
) ([]rules.Diagnostic, []rules.Diagnostic, error)

FilterDiagnostics retains diagnostics intersecting changed lines, records pre-existing diagnostics separately, and exposes only fixes wholly owned by the changed lines.

func (*Scope) Lines

func (s *Scope) Lines(path string) []LineRange

Lines returns changed physical lines for path.

func (*Scope) MergeBase

func (s *Scope) MergeBase() string

MergeBase returns the selected full Git object identity.

func (*Scope) OwnsTransformation

func (s *Scope) OwnsTransformation(file *source.File, after []byte) (bool, error)

OwnsTransformation reports whether every original source line changed by after belongs to the changed-code scope.

func (*Scope) Root

func (s *Scope) Root() string

Root returns the normalized absolute repository root.

func (*Scope) WholeFile

func (s *Scope) WholeFile(path string) bool

WholeFile reports whether every line of path is owned by the change.

Jump to

Keyboard shortcuts

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