plumbing

package
v0.0.0-...-05004e4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0, Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package plumbing provides plumbing functionality.

Index

Constants

View Source
const (
	// ConfigBlobCacheFailOnMissingSubmodules is the configuration key for failing on missing submodules.
	ConfigBlobCacheFailOnMissingSubmodules = "BlobCache.FailOnMissingSubmodules"
	// ConfigBlobCacheGoroutines is the configuration key for parallel blob loading.
	ConfigBlobCacheGoroutines = "BlobCache.Goroutines"
)
View Source
const (
	// ConfigFileDiffDisableCleanup is the configuration key for disabling diff cleanup.
	ConfigFileDiffDisableCleanup = "FileDiff.NoCleanup"
	// ConfigFileWhitespaceIgnore is the configuration key for ignoring whitespace in diffs.
	ConfigFileWhitespaceIgnore = "FileDiff.WhitespaceIgnore"
	// ConfigFileDiffTimeout is the configuration key for the diff computation timeout.
	ConfigFileDiffTimeout = "FileDiff.Timeout"
	// ConfigFileDiffGoroutines is the configuration key for the number of parallel diff goroutines.
	ConfigFileDiffGoroutines = "FileDiff.Goroutines"
)
View Source
const (
	// ConfigIdentityDetectorPeopleDictPath is the configuration key for the people dictionary file path.
	ConfigIdentityDetectorPeopleDictPath = "IdentityDetector.PeopleDictPath"
	// ConfigIdentityDetectorExactSignatures is the configuration key for requiring exact author signatures.
	ConfigIdentityDetectorExactSignatures = "IdentityDetector.ExactSignatures"
)
View Source
const (
	// ConfigTicksSinceStartTickSize is the configuration key for the tick size in hours.
	ConfigTicksSinceStartTickSize = "TicksSinceStart.TickSize"
	// DefaultTicksSinceStartTickSize is the default tick size in hours.
	DefaultTicksSinceStartTickSize = 24
)
View Source
const (
	// ConfigTreeDiffEnableBlacklist is the configuration key for enabling path blacklisting.
	ConfigTreeDiffEnableBlacklist = "TreeDiff.EnableBlacklist"
	// ConfigTreeDiffBlacklistedPrefixes is the configuration key for path prefixes to exclude from diffs.
	ConfigTreeDiffBlacklistedPrefixes = "TreeDiff.BlacklistedPrefixes"
	// ConfigTreeDiffLanguages is the configuration key for filtering by programming language.
	ConfigTreeDiffLanguages = "TreeDiff.LanguagesDetection"
	// ConfigTreeDiffFilterRegexp is the configuration key for the file path filter regular expression.
	ConfigTreeDiffFilterRegexp = "TreeDiff.FilteredRegexes"
)
View Source
const (
	// FeatureUast is the feature flag for UAST-based analysis.
	FeatureUast = "uast"

	// ConfigUASTChangesGoroutines is the configuration key for parallel UAST parsing.
	ConfigUASTChangesGoroutines = "UASTChanges.Goroutines"
)
View Source
const (
	// ConfigLanguagesDetection is the configuration key for language detection settings.
	ConfigLanguagesDetection = "LanguagesDetection"
)
View Source
const (
	DefaultValue = 1000
)

DefaultValue is the default timeout in milliseconds for file diff operations.

Variables

View Source
var ErrInvalidSkipFiles = errors.New("expected []string for SkipFiles")

ErrInvalidSkipFiles indicates a type assertion failure for SkipFiles configuration.

Functions

func FloorTime

func FloorTime(t time.Time, d time.Duration) time.Time

FloorTime rounds a timestamp down to the nearest tick boundary.

func ReleaseSnapshotUAST

func ReleaseSnapshotUAST(s Snapshot)

ReleaseSnapshotUAST releases UAST trees owned by the snapshot.

Types

type BlobCacheAnalyzer

type BlobCacheAnalyzer struct {
	TreeDiff   *TreeDiffAnalyzer
	Repository *gitlib.Repository

	Cache                   map[gitlib.Hash]*gitlib.CachedBlob
	FailOnMissingSubmodules bool
	Goroutines              int
	// contains filtered or unexported fields
}

BlobCacheAnalyzer loads and caches file blobs for each commit.

func (*BlobCacheAnalyzer) AvgTCSize

func (b *BlobCacheAnalyzer) AvgTCSize() int64

AvgTCSize returns 0 — plumbing analyzers do not emit meaningful TC payloads.

func (*BlobCacheAnalyzer) Configure

func (b *BlobCacheAnalyzer) Configure(facts map[string]any) error

Configure sets up the analyzer with the provided facts.

func (*BlobCacheAnalyzer) Consume

func (b *BlobCacheAnalyzer) Consume(ctx context.Context, ac *analyze.Context) (analyze.TC, error)

Consume processes a single commit with the provided dependency results.

func (*BlobCacheAnalyzer) Description

func (b *BlobCacheAnalyzer) Description() string

Description returns a human-readable description of the analyzer.

func (*BlobCacheAnalyzer) Descriptor

func (b *BlobCacheAnalyzer) Descriptor() analyze.Descriptor

Descriptor returns stable analyzer metadata.

func (*BlobCacheAnalyzer) Flag

func (b *BlobCacheAnalyzer) Flag() string

Flag returns the CLI flag for the analyzer.

func (*BlobCacheAnalyzer) Fork

Fork creates a copy of the analyzer for parallel processing.

func (*BlobCacheAnalyzer) Initialize

func (b *BlobCacheAnalyzer) Initialize(repo *gitlib.Repository) error

Initialize prepares the analyzer for processing commits.

func (*BlobCacheAnalyzer) InjectPreparedData

func (b *BlobCacheAnalyzer) InjectPreparedData(
	_ []*gitlib.Change,
	cache map[gitlib.Hash]*gitlib.CachedBlob,
	_ map[string]any,
)

InjectPreparedData sets pre-computed cache from parallel preparation.

func (*BlobCacheAnalyzer) ListConfigurationOptions

func (b *BlobCacheAnalyzer) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns the configuration options for the analyzer.

func (*BlobCacheAnalyzer) Merge

Merge combines results from forked analyzer branches.

func (*BlobCacheAnalyzer) Name

func (b *BlobCacheAnalyzer) Name() string

Name returns the name of the analyzer.

func (*BlobCacheAnalyzer) NewAggregator

NewAggregator returns nil — plumbing analyzers do not aggregate.

func (*BlobCacheAnalyzer) ReportFromTICKs

func (b *BlobCacheAnalyzer) ReportFromTICKs(_ context.Context, _ []analyze.TICK) (analyze.Report, error)

ReportFromTICKs returns ErrNotImplemented — plumbing analyzers do not produce reports.

func (*BlobCacheAnalyzer) Serialize

func (b *BlobCacheAnalyzer) Serialize(report analyze.Report, format string, writer io.Writer) error

Serialize writes the analysis result to the given writer.

func (*BlobCacheAnalyzer) SerializeTICKs

func (b *BlobCacheAnalyzer) SerializeTICKs(_ []analyze.TICK, _ string, _ io.Writer) error

SerializeTICKs returns ErrNotImplemented — plumbing analyzers do not produce TICKs.

func (*BlobCacheAnalyzer) WorkingStateSize

func (b *BlobCacheAnalyzer) WorkingStateSize() int64

WorkingStateSize returns 0 — plumbing analyzers are excluded from budget planning.

type ChangeRouter

type ChangeRouter struct {
	OnInsert func(change *gitlib.Change) error
	OnDelete func(change *gitlib.Change) error
	OnModify func(change *gitlib.Change) error
	OnRename func(from, to string, change *gitlib.Change) error
}

ChangeRouter routes tree-diff changes to appropriate handlers.

func (*ChangeRouter) Route

func (r *ChangeRouter) Route(changes gitlib.Changes) error

Route iterates over the given changes and delegates to the configured handlers.

type FileDiffAnalyzer

type FileDiffAnalyzer struct {
	TreeDiff         *TreeDiffAnalyzer
	BlobCache        *BlobCacheAnalyzer
	FileDiffs        map[string]pkgplumbing.FileDiffData
	Timeout          time.Duration
	Goroutines       int
	CleanupDisabled  bool
	WhitespaceIgnore bool
	// contains filtered or unexported fields
}

FileDiffAnalyzer computes file-level diffs for each commit.

func (*FileDiffAnalyzer) AvgTCSize

func (f *FileDiffAnalyzer) AvgTCSize() int64

AvgTCSize returns 0 — plumbing analyzers do not emit meaningful TC payloads.

func (*FileDiffAnalyzer) Configure

func (f *FileDiffAnalyzer) Configure(facts map[string]any) error

Configure sets up the analyzer with the provided facts.

func (*FileDiffAnalyzer) Consume

Consume processes a single commit with the provided dependency results.

func (*FileDiffAnalyzer) Description

func (f *FileDiffAnalyzer) Description() string

Description returns a human-readable description of the analyzer.

func (*FileDiffAnalyzer) Descriptor

func (f *FileDiffAnalyzer) Descriptor() analyze.Descriptor

Descriptor returns stable analyzer metadata.

func (*FileDiffAnalyzer) Flag

func (f *FileDiffAnalyzer) Flag() string

Flag returns the CLI flag for the analyzer.

func (*FileDiffAnalyzer) Fork

Fork creates a copy of the analyzer for parallel processing.

func (*FileDiffAnalyzer) Initialize

func (f *FileDiffAnalyzer) Initialize(repo *gitlib.Repository) error

Initialize prepares the analyzer for processing commits.

func (*FileDiffAnalyzer) InjectPreparedData

func (f *FileDiffAnalyzer) InjectPreparedData(
	_ []*gitlib.Change,
	_ map[gitlib.Hash]*gitlib.CachedBlob,
	fileDiffs any,
)

InjectPreparedData sets pre-computed file diffs from parallel preparation.

func (*FileDiffAnalyzer) ListConfigurationOptions

func (f *FileDiffAnalyzer) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns the configuration options for the analyzer.

func (*FileDiffAnalyzer) Merge

Merge combines results from forked analyzer branches.

func (*FileDiffAnalyzer) Name

func (f *FileDiffAnalyzer) Name() string

Name returns the name of the analyzer.

func (*FileDiffAnalyzer) NewAggregator

NewAggregator returns nil — plumbing analyzers do not aggregate.

func (*FileDiffAnalyzer) ReportFromTICKs

func (f *FileDiffAnalyzer) ReportFromTICKs(_ context.Context, _ []analyze.TICK) (analyze.Report, error)

ReportFromTICKs returns ErrNotImplemented — plumbing analyzers do not produce reports.

func (*FileDiffAnalyzer) Serialize

func (f *FileDiffAnalyzer) Serialize(report analyze.Report, format string, writer io.Writer) error

Serialize writes the analysis result to the given writer.

func (*FileDiffAnalyzer) SerializeTICKs

func (f *FileDiffAnalyzer) SerializeTICKs(_ []analyze.TICK, _ string, _ io.Writer) error

SerializeTICKs returns ErrNotImplemented — plumbing analyzers do not produce TICKs.

func (*FileDiffAnalyzer) WorkingStateSize

func (f *FileDiffAnalyzer) WorkingStateSize() int64

WorkingStateSize returns 0 — plumbing analyzers are excluded from budget planning.

type IdentityDetector

type IdentityDetector struct {
	PeopleDict         map[string]int
	PeopleDictPath     string
	ReversedPeopleDict []string
	AuthorID           int
	ExactSignatures    bool
	// contains filtered or unexported fields
}

IdentityDetector maps commit authors to canonical developer identities.

func (*IdentityDetector) AvgTCSize

func (d *IdentityDetector) AvgTCSize() int64

AvgTCSize returns 0 — plumbing analyzers do not emit meaningful TC payloads.

func (*IdentityDetector) Configure

func (d *IdentityDetector) Configure(facts map[string]any) error

Configure sets up the analyzer with the provided facts.

func (*IdentityDetector) Consume

Consume processes a single commit with the provided dependency results.

func (*IdentityDetector) Description

func (d *IdentityDetector) Description() string

Description returns a human-readable description of the analyzer.

func (*IdentityDetector) Descriptor

func (d *IdentityDetector) Descriptor() analyze.Descriptor

Descriptor returns stable analyzer metadata.

func (*IdentityDetector) FinalizeDict

func (d *IdentityDetector) FinalizeDict()

FinalizeDict builds ReversedPeopleDict if it was collected incrementally.

func (*IdentityDetector) Flag

func (d *IdentityDetector) Flag() string

Flag returns the CLI flag for the analyzer.

func (*IdentityDetector) Fork

Fork creates a copy of the analyzer for parallel processing.

func (*IdentityDetector) GeneratePeopleDict

func (d *IdentityDetector) GeneratePeopleDict(commits []*gitlib.Commit)

GeneratePeopleDict builds the author identity mapping.

func (*IdentityDetector) GetAuthorID

func (d *IdentityDetector) GetAuthorID() int

GetAuthorID returns the author ID of the last processed commit.

func (*IdentityDetector) Initialize

func (d *IdentityDetector) Initialize(_ *gitlib.Repository) error

Initialize prepares the analyzer for processing commits.

func (*IdentityDetector) ListConfigurationOptions

func (d *IdentityDetector) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns the configuration options for the analyzer.

func (*IdentityDetector) LoadPeopleDict

func (d *IdentityDetector) LoadPeopleDict(path string) error

LoadPeopleDict loads the author identity mapping from a file.

func (*IdentityDetector) Merge

Merge combines results from forked analyzer branches.

func (*IdentityDetector) Name

func (d *IdentityDetector) Name() string

Name returns the name of the analyzer.

func (*IdentityDetector) NewAggregator

NewAggregator returns nil — plumbing analyzers do not aggregate.

func (*IdentityDetector) ReportFromTICKs

func (d *IdentityDetector) ReportFromTICKs(_ context.Context, _ []analyze.TICK) (analyze.Report, error)

ReportFromTICKs returns ErrNotImplemented — plumbing analyzers do not produce reports.

func (*IdentityDetector) Serialize

func (d *IdentityDetector) Serialize(report analyze.Report, format string, writer io.Writer) error

Serialize writes the analysis result to the given writer.

func (*IdentityDetector) SerializeTICKs

func (d *IdentityDetector) SerializeTICKs(_ []analyze.TICK, _ string, _ io.Writer) error

SerializeTICKs returns ErrNotImplemented — plumbing analyzers do not produce TICKs.

func (*IdentityDetector) WorkingStateSize

func (d *IdentityDetector) WorkingStateSize() int64

WorkingStateSize returns 0 — plumbing analyzers are excluded from budget planning.

type LanguagesDetectionAnalyzer

type LanguagesDetectionAnalyzer struct {
	// Dependencies.
	TreeDiff  *TreeDiffAnalyzer
	BlobCache *BlobCacheAnalyzer
	// contains filtered or unexported fields
}

LanguagesDetectionAnalyzer detects programming languages of changed files. It uses lazy detection - languages are only computed when Languages() is called.

func (*LanguagesDetectionAnalyzer) AvgTCSize

func (l *LanguagesDetectionAnalyzer) AvgTCSize() int64

AvgTCSize returns 0 — plumbing analyzers do not emit meaningful TC payloads.

func (*LanguagesDetectionAnalyzer) Configure

func (l *LanguagesDetectionAnalyzer) Configure(_ map[string]any) error

Configure sets up the analyzer with the provided facts.

func (*LanguagesDetectionAnalyzer) Consume

Consume resets state for the new commit. Detection is deferred until Languages() is called.

func (*LanguagesDetectionAnalyzer) Description

func (l *LanguagesDetectionAnalyzer) Description() string

Description returns a human-readable description of the analyzer.

func (*LanguagesDetectionAnalyzer) Descriptor

Descriptor returns stable analyzer metadata.

func (*LanguagesDetectionAnalyzer) Flag

Flag returns the CLI flag for the analyzer.

func (*LanguagesDetectionAnalyzer) Fork

Fork creates a copy of the analyzer for parallel processing.

func (*LanguagesDetectionAnalyzer) Initialize

Initialize prepares the analyzer for processing commits.

func (*LanguagesDetectionAnalyzer) Languages

func (l *LanguagesDetectionAnalyzer) Languages() map[gitlib.Hash]string

Languages returns detected languages, computing lazily on first call per commit. This avoids expensive language detection when downstream analyzers don't need it.

func (*LanguagesDetectionAnalyzer) ListConfigurationOptions

func (l *LanguagesDetectionAnalyzer) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns the configuration options for the analyzer.

func (*LanguagesDetectionAnalyzer) Merge

Merge combines results from forked analyzer branches.

func (*LanguagesDetectionAnalyzer) Name

Name returns the name of the analyzer.

func (*LanguagesDetectionAnalyzer) NewAggregator

NewAggregator returns nil — plumbing analyzers do not aggregate.

func (*LanguagesDetectionAnalyzer) ReportFromTICKs

func (l *LanguagesDetectionAnalyzer) ReportFromTICKs(_ context.Context, _ []analyze.TICK) (analyze.Report, error)

ReportFromTICKs returns ErrNotImplemented — plumbing analyzers do not produce reports.

func (*LanguagesDetectionAnalyzer) Serialize

func (l *LanguagesDetectionAnalyzer) Serialize(report analyze.Report, format string, writer io.Writer) error

Serialize writes the analysis result to the given writer.

func (*LanguagesDetectionAnalyzer) SerializeTICKs

func (l *LanguagesDetectionAnalyzer) SerializeTICKs(_ []analyze.TICK, _ string, _ io.Writer) error

SerializeTICKs returns ErrNotImplemented — plumbing analyzers do not produce TICKs.

func (*LanguagesDetectionAnalyzer) SetLanguages

func (l *LanguagesDetectionAnalyzer) SetLanguages(languages map[gitlib.Hash]string)

SetLanguages sets the languages directly, marking them as parsed.

func (*LanguagesDetectionAnalyzer) SetLanguagesForTest

func (l *LanguagesDetectionAnalyzer) SetLanguagesForTest(languages map[gitlib.Hash]string)

SetLanguagesForTest sets the languages directly (for testing only).

func (*LanguagesDetectionAnalyzer) WorkingStateSize

func (l *LanguagesDetectionAnalyzer) WorkingStateSize() int64

WorkingStateSize returns 0 — plumbing analyzers are excluded from budget planning.

type LinesStatsCalculator

type LinesStatsCalculator struct {
	// Dependencies.
	TreeDiff  *TreeDiffAnalyzer
	BlobCache *BlobCacheAnalyzer
	FileDiff  *FileDiffAnalyzer

	// Output.
	LineStats map[gitlib.ChangeEntry]pkgplumbing.LineStats
}

LinesStatsCalculator computes line-level statistics for file diffs.

func (*LinesStatsCalculator) AvgTCSize

func (l *LinesStatsCalculator) AvgTCSize() int64

AvgTCSize returns 0 — plumbing analyzers do not emit meaningful TC payloads.

func (*LinesStatsCalculator) Configure

func (l *LinesStatsCalculator) Configure(_ map[string]any) error

Configure sets up the analyzer with the provided facts.

func (*LinesStatsCalculator) Consume

Consume processes a single commit with the provided dependency results.

func (*LinesStatsCalculator) Description

func (l *LinesStatsCalculator) Description() string

Description returns a human-readable description of the analyzer.

func (*LinesStatsCalculator) Descriptor

func (l *LinesStatsCalculator) Descriptor() analyze.Descriptor

Descriptor returns stable analyzer metadata.

func (*LinesStatsCalculator) Flag

func (l *LinesStatsCalculator) Flag() string

Flag returns the CLI flag for the analyzer.

func (*LinesStatsCalculator) Fork

Fork creates a copy of the analyzer for parallel processing.

func (*LinesStatsCalculator) Initialize

func (l *LinesStatsCalculator) Initialize(_ *gitlib.Repository) error

Initialize prepares the analyzer for processing commits.

func (*LinesStatsCalculator) ListConfigurationOptions

func (l *LinesStatsCalculator) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns the configuration options for the analyzer.

func (*LinesStatsCalculator) Merge

Merge combines results from forked analyzer branches.

func (*LinesStatsCalculator) Name

func (l *LinesStatsCalculator) Name() string

Name returns the name of the analyzer.

func (*LinesStatsCalculator) NewAggregator

NewAggregator returns nil — plumbing analyzers do not aggregate.

func (*LinesStatsCalculator) ReportFromTICKs

func (l *LinesStatsCalculator) ReportFromTICKs(_ context.Context, _ []analyze.TICK) (analyze.Report, error)

ReportFromTICKs returns ErrNotImplemented — plumbing analyzers do not produce reports.

func (*LinesStatsCalculator) Serialize

func (l *LinesStatsCalculator) Serialize(report analyze.Report, format string, writer io.Writer) error

Serialize writes the analysis result to the given writer.

func (*LinesStatsCalculator) SerializeTICKs

func (l *LinesStatsCalculator) SerializeTICKs(_ []analyze.TICK, _ string, _ io.Writer) error

SerializeTICKs returns ErrNotImplemented — plumbing analyzers do not produce TICKs.

func (*LinesStatsCalculator) WorkingStateSize

func (l *LinesStatsCalculator) WorkingStateSize() int64

WorkingStateSize returns 0 — plumbing analyzers are excluded from budget planning.

type Snapshot

type Snapshot struct {
	Changes   gitlib.Changes
	BlobCache map[gitlib.Hash]*gitlib.CachedBlob
	FileDiffs map[string]pkgplumbing.FileDiffData
	LineStats map[gitlib.ChangeEntry]pkgplumbing.LineStats
	Languages map[gitlib.Hash]string
	Tick      int
	AuthorID  int
	// UASTChanges ownership is transferred to the snapshot.
	// The consumer must call ReleaseSnapshotUAST to free UAST trees.
	UASTChanges []uast.Change
}

Snapshot captures the output state of all plumbing analyzers for one commit. Leaf analyzers use this to implement analyze.Parallelizable, keeping the framework agnostic of concrete plumbing types.

func (Snapshot) Clone

func (s Snapshot) Clone() Snapshot

Clone creates a shallow clone of the snapshot's reference types (maps and slices), enforcing immutability of the core analyzers' state while avoiding deep-copying immutable git objects or UAST nodes.

type TicksSinceStart

type TicksSinceStart struct {
	TickSize time.Duration

	Tick int
	// contains filtered or unexported fields
}

TicksSinceStart computes relative time ticks for each commit since the start.

func (*TicksSinceStart) AvgTCSize

func (t *TicksSinceStart) AvgTCSize() int64

AvgTCSize returns 0 — plumbing analyzers do not emit meaningful TC payloads.

func (*TicksSinceStart) Configure

func (t *TicksSinceStart) Configure(facts map[string]any) error

Configure sets up the analyzer with the provided facts.

func (*TicksSinceStart) Consume

func (t *TicksSinceStart) Consume(_ context.Context, ac *analyze.Context) (analyze.TC, error)

Consume processes a single commit with the provided dependency results.

func (*TicksSinceStart) CurrentTick

func (t *TicksSinceStart) CurrentTick() int

CurrentTick returns the tick value of the last processed commit.

func (*TicksSinceStart) Description

func (t *TicksSinceStart) Description() string

Description returns a human-readable description of the analyzer.

func (*TicksSinceStart) Descriptor

func (t *TicksSinceStart) Descriptor() analyze.Descriptor

Descriptor returns stable analyzer metadata.

func (*TicksSinceStart) Flag

func (t *TicksSinceStart) Flag() string

Flag returns the CLI flag for the analyzer.

func (*TicksSinceStart) Fork

Fork creates a copy of the analyzer for parallel processing.

func (*TicksSinceStart) Initialize

func (t *TicksSinceStart) Initialize(_ *gitlib.Repository) error

Initialize prepares the analyzer for processing commits.

func (*TicksSinceStart) ListConfigurationOptions

func (t *TicksSinceStart) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns the configuration options for the analyzer.

func (*TicksSinceStart) Merge

func (t *TicksSinceStart) Merge(_ []analyze.HistoryAnalyzer)

Merge combines results from forked analyzer branches.

func (*TicksSinceStart) Name

func (t *TicksSinceStart) Name() string

Name returns the name of the analyzer.

func (*TicksSinceStart) NewAggregator

NewAggregator returns nil — plumbing analyzers do not aggregate.

func (*TicksSinceStart) ReportFromTICKs

func (t *TicksSinceStart) ReportFromTICKs(_ context.Context, _ []analyze.TICK) (analyze.Report, error)

ReportFromTICKs returns ErrNotImplemented — plumbing analyzers do not produce reports.

func (*TicksSinceStart) Serialize

func (t *TicksSinceStart) Serialize(report analyze.Report, format string, writer io.Writer) error

Serialize writes the analysis result to the given writer.

func (*TicksSinceStart) SerializeTICKs

func (t *TicksSinceStart) SerializeTICKs(_ []analyze.TICK, _ string, _ io.Writer) error

SerializeTICKs returns ErrNotImplemented — plumbing analyzers do not produce TICKs.

func (*TicksSinceStart) WorkingStateSize

func (t *TicksSinceStart) WorkingStateSize() int64

WorkingStateSize returns 0 — plumbing analyzers are excluded from budget planning.

type TreeDiffAnalyzer

type TreeDiffAnalyzer struct {
	NameFilter *regexp.Regexp
	Languages  map[string]bool

	Repository *gitlib.Repository
	SkipFiles  []string
	Changes    gitlib.Changes
	// contains filtered or unexported fields
}

TreeDiffAnalyzer computes tree-level diffs between commits.

func (*TreeDiffAnalyzer) AvgTCSize

func (t *TreeDiffAnalyzer) AvgTCSize() int64

AvgTCSize returns 0 — plumbing analyzers do not emit meaningful TC payloads.

func (*TreeDiffAnalyzer) Configure

func (t *TreeDiffAnalyzer) Configure(facts map[string]any) error

Configure sets up the analyzer with the provided facts.

func (*TreeDiffAnalyzer) Consume

func (t *TreeDiffAnalyzer) Consume(ctx context.Context, ac *analyze.Context) (analyze.TC, error)

Consume processes a single commit with the provided dependency results.

func (*TreeDiffAnalyzer) Description

func (t *TreeDiffAnalyzer) Description() string

Description returns a human-readable description of the analyzer.

func (*TreeDiffAnalyzer) Descriptor

func (t *TreeDiffAnalyzer) Descriptor() analyze.Descriptor

Descriptor returns stable analyzer metadata.

func (*TreeDiffAnalyzer) Flag

func (t *TreeDiffAnalyzer) Flag() string

Flag returns the CLI flag for the analyzer.

func (*TreeDiffAnalyzer) Fork

Fork creates a copy of the analyzer for parallel processing.

func (*TreeDiffAnalyzer) Initialize

func (t *TreeDiffAnalyzer) Initialize(repository *gitlib.Repository) error

Initialize prepares the analyzer for processing commits.

func (*TreeDiffAnalyzer) InjectPreparedData

func (t *TreeDiffAnalyzer) InjectPreparedData(
	changes []*gitlib.Change,
	_ map[gitlib.Hash]*gitlib.CachedBlob,
	_ any,
)

InjectPreparedData sets pre-computed changes from parallel preparation.

func (*TreeDiffAnalyzer) ListConfigurationOptions

func (t *TreeDiffAnalyzer) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns the configuration options for the analyzer.

func (*TreeDiffAnalyzer) Merge

Merge combines results from forked analyzer branches.

func (*TreeDiffAnalyzer) Name

func (t *TreeDiffAnalyzer) Name() string

Name returns the name of the analyzer.

func (*TreeDiffAnalyzer) NewAggregator

NewAggregator returns nil — plumbing analyzers do not aggregate.

func (*TreeDiffAnalyzer) ReportFromTICKs

func (t *TreeDiffAnalyzer) ReportFromTICKs(_ context.Context, _ []analyze.TICK) (analyze.Report, error)

ReportFromTICKs returns ErrNotImplemented — plumbing analyzers do not produce reports.

func (*TreeDiffAnalyzer) Serialize

func (t *TreeDiffAnalyzer) Serialize(report analyze.Report, format string, writer io.Writer) error

Serialize writes the analysis result to the given writer.

func (*TreeDiffAnalyzer) SerializeTICKs

func (t *TreeDiffAnalyzer) SerializeTICKs(_ []analyze.TICK, _ string, _ io.Writer) error

SerializeTICKs returns ErrNotImplemented — plumbing analyzers do not produce TICKs.

func (*TreeDiffAnalyzer) WorkingStateSize

func (t *TreeDiffAnalyzer) WorkingStateSize() int64

WorkingStateSize returns 0 — plumbing analyzers are excluded from budget planning.

type UASTChangesAnalyzer

type UASTChangesAnalyzer struct {
	TreeDiff   *TreeDiffAnalyzer
	BlobCache  *BlobCacheAnalyzer
	Goroutines int
	// contains filtered or unexported fields
}

UASTChangesAnalyzer extracts UAST-level changes between commits. It uses lazy parsing - changes are only parsed when Changes() is called.

func (*UASTChangesAnalyzer) AvgTCSize

func (c *UASTChangesAnalyzer) AvgTCSize() int64

AvgTCSize returns 0 — plumbing analyzers do not emit meaningful TC payloads.

func (*UASTChangesAnalyzer) Changes

func (c *UASTChangesAnalyzer) Changes(ctx context.Context) []uast.Change

Changes returns parsed UAST changes, parsing lazily on first call per commit. This avoids expensive UAST parsing when downstream analyzers don't need it.

func (*UASTChangesAnalyzer) Configure

func (c *UASTChangesAnalyzer) Configure(facts map[string]any) error

Configure sets up the analyzer with the provided facts.

func (*UASTChangesAnalyzer) Consume

Consume resets state for the new commit. Parsing is deferred until Changes() is called. Releases previous commit's UAST trees back to the node/positions pools. If the context contains pre-computed UAST changes from the pipeline, they are used directly.

func (*UASTChangesAnalyzer) Description

func (c *UASTChangesAnalyzer) Description() string

Description returns a human-readable description of the analyzer.

func (*UASTChangesAnalyzer) Descriptor

func (c *UASTChangesAnalyzer) Descriptor() analyze.Descriptor

Descriptor returns stable analyzer metadata.

func (*UASTChangesAnalyzer) Flag

func (c *UASTChangesAnalyzer) Flag() string

Flag returns the CLI flag for the analyzer.

func (*UASTChangesAnalyzer) Fork

Fork creates a copy of the analyzer for parallel processing.

func (*UASTChangesAnalyzer) Initialize

func (c *UASTChangesAnalyzer) Initialize(_ *gitlib.Repository) error

Initialize prepares the analyzer for processing commits.

func (*UASTChangesAnalyzer) ListConfigurationOptions

func (c *UASTChangesAnalyzer) ListConfigurationOptions() []pipeline.ConfigurationOption

ListConfigurationOptions returns the configuration options for the analyzer.

func (*UASTChangesAnalyzer) Merge

Merge combines results from forked analyzer branches.

func (*UASTChangesAnalyzer) Name

func (c *UASTChangesAnalyzer) Name() string

Name returns the name of the analyzer.

func (*UASTChangesAnalyzer) NewAggregator

NewAggregator returns nil — plumbing analyzers do not aggregate.

func (*UASTChangesAnalyzer) ReportFromTICKs

func (c *UASTChangesAnalyzer) ReportFromTICKs(_ context.Context, _ []analyze.TICK) (analyze.Report, error)

ReportFromTICKs returns ErrNotImplemented — plumbing analyzers do not produce reports.

func (*UASTChangesAnalyzer) Serialize

func (c *UASTChangesAnalyzer) Serialize(report analyze.Report, format string, writer io.Writer) error

Serialize writes the analysis result to the given writer.

func (*UASTChangesAnalyzer) SerializeTICKs

func (c *UASTChangesAnalyzer) SerializeTICKs(_ []analyze.TICK, _ string, _ io.Writer) error

SerializeTICKs returns ErrNotImplemented — plumbing analyzers do not produce TICKs.

func (*UASTChangesAnalyzer) SetChanges

func (c *UASTChangesAnalyzer) SetChanges(changes []uast.Change)

SetChanges sets the changes directly, marking them as parsed.

func (*UASTChangesAnalyzer) SetChangesForTest

func (c *UASTChangesAnalyzer) SetChangesForTest(changes []uast.Change)

SetChangesForTest sets the changes directly (for testing only).

func (*UASTChangesAnalyzer) TransferChanges

func (c *UASTChangesAnalyzer) TransferChanges() []uast.Change

TransferChanges returns the current changes and clears the internal reference without releasing the UAST trees. The caller takes ownership of the returned changes and is responsible for releasing them.

func (*UASTChangesAnalyzer) WorkingStateSize

func (c *UASTChangesAnalyzer) WorkingStateSize() int64

WorkingStateSize returns 0 — plumbing analyzers are excluded from budget planning.

Jump to

Keyboard shortcuts

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