suppressdrift

package
v3.73.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package suppressdrift relocates code-anchored suppressions (nosec directives and file/line ignore rules) as the code they pin to moves through git history. Given the snippet a rule was created against, it finds where that snippet now lives — following file renames and line shifts via go-git blame and tree diffs — so the stored file path and line number stay accurate. When the snippet is gone from the current tree the rule is flagged for auto-deactivation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anchor

type Anchor struct {
	Key        string // caller correlation key (e.g. fingerprint or uuid)
	FilePath   string
	LineNumber int
	Snippet    string
}

Anchor is one suppression to relocate. Snippet is the code the rule is pinned to; FilePath/LineNumber are its last-known location.

type Result

type Result struct {
	Key      string
	FilePath string // current path (may differ from Anchor.FilePath on rename)
	Line     int    // current 1-based line
	Commit   string // commit that last touched the anchored line (best-effort)
	Gone     bool   // snippet not found anywhere in the working tree
	Moved    bool   // path or line changed from the Anchor
}

Result is the reconciled location of an Anchor.

func Reconcile

func Reconcile(repoRoot string, anchors []Anchor) ([]Result, error)

Reconcile relocates every anchor against the git repo rooted at repoRoot. On any git error it returns (nil, err) and the caller should fall back to the on-disk snippet check — drift tracking is best-effort, never fatal.

Jump to

Keyboard shortcuts

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