suppressdrift

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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