Documentation
¶
Overview ¶
Package guard builds repository checks from data: each types.GuardRow becomes one or more interfaces.Guard probes over a codebase. The declarative kinds are match (line patterns), yaml (a path query) and expr (a CEL expression over files, documents and rendered objects); a go row runs the GoGuard the product registers under its name, with the expanded row, so one Go guard serves many rows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFromConfig ¶
NewFromConfig validates rows and returns their guards. Expansion runs when a guard runs, so building does no I/O. An unknown kind or expander, a go row with no registered guard, a bad pattern or a CEL expression that does not compile is CodeInvalidInput naming the row.
Types ¶
type Deps ¶
type Deps struct {
// Expanders are the product's iteration domains, keyed by the name rows use in each.
Expanders map[string]Expander
// Go are the product's computed guards, keyed by the name a go row carries.
Go map[string]GoGuard
// Cache remembers a go row's passes on its inputs (see GuardRow.Inputs); nil never
// hits, so every expansion runs.
Cache interfaces.StepCache
// Versions returns a tool's version for the cache key; nil keys every tool at "".
Versions func(tool string) string
// RenderTool names the binary the codebase's renderer shells (helm), listed among
// the tools of every row that renders a chart; empty lists none.
RenderTool string
}
Deps carries what the guards need besides their rows.
type Expander ¶
Expander lists the rows a guard row with `each:` expands over: one map of placeholder values per guard to build.
type GoGuard ¶ added in v0.0.20
type GoGuard func( ctx context.Context, cb interfaces.Codebase, row *types.GuardRow, vars map[string]string, ) ([]types.Finding, error)
GoGuard is a product check the declarative kinds cannot express. It runs once per expansion of its row, with the expanded row (its selector, render spec and message) and the expansion's placeholders, and returns its findings; none is a pass.