engine

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 16 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

allowlist_fold.go — the run-scoped state exemption suppression needs beyond the finding it is judging. Split from engine.go, which the 750-line vendor cap bounds; same package.

Package engine runs compiled rules over a FileSet: phase 1 fans files out to a worker pool, phase 2 fans finalizers out to a second one (spec §6). A crashed rule is an engine error, never a pass (spec §11).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(rls []*config.Rule, fset *scan.FileSet, workers int) ([]finding.Finding, error)

Run evaluates every rule against every in-scope file, then finalizers. workers <= 0 means GOMAXPROCS. Findings come back deterministically sorted and include suppressed findings (spec §5 exemptions): callers that gate on findings must filter with finding.Unsuppressed.

Types

type Timing added in v0.6.2

type Timing map[string]time.Duration

Run evaluates every rule against every in-scope file, then finalizers. workers <= 0 means GOMAXPROCS. Findings come back deterministically sorted and include suppressed findings (spec §5 exemptions): callers that gate on findings must filter with finding.Unsuppressed. Timing records per-rule total evaluation wall time: phase 1 sums the rule's per-file evaluations, phase 2 adds its finalizer. It is observability, never input to a verdict — no finding, sort order, or exit code reads it.

func RunTimed added in v0.6.2

func RunTimed(rls []*config.Rule, fset *scan.FileSet, workers int, progress func(ruleID string, elapsed time.Duration)) ([]finding.Finding, Timing, error)

RunTimed is Run plus per-rule wall-clock accounting, and an optional completion callback: progress (may be nil) is invoked under the findings mutex as each finalizer finishes, with the rule's ID and its accumulated total — the hook behind `check -progress`. That flag exists because a whole-corpus lane can run for minutes with no output (every report format writes at the end), and an operator staring at a silent job cannot tell a slow rule from a hung one. Phase 1 cannot report per-rule completion the same way (a rule is complete only once every file has been visited), so the callback is finalizer-only; Timing covers both phases either way.

Jump to

Keyboard shortcuts

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