Documentation
¶
Overview ¶
Package suite is stickler's core vocabulary: the target a check runs over, the check interface every runner satisfies, and the aggregated result with its soft-fail ratchet.
It is a leaf. Nothing here knows how a check is implemented, configured, or rendered — which is what lets the runner, report, and check packages all depend on it without depending on each other.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Explainer ¶ added in v0.12.0
type Explainer interface {
Explain(ctx context.Context) (Instructions, error)
}
Explainer is a runner that can state the rules it enforces, in prose an agent can write conforming code from.
It is OPTIONAL, and deliberately separate from Runner: a tool that reports findings need not be able to explain itself, and pretending otherwise would mean inventing prose on its behalf. A runner that does not implement this is reported as unable to explain itself — which is a fact worth showing, not one worth papering over with a guess.
type Instructions ¶ added in v0.12.0
type Instructions string
Instructions is what one runner has to say about the rules it enforces.
type Result ¶
type Result struct {
Diagnostics []goyze.Diagnostic
Errors []error
// Skipped names every runner that was selected and had nothing to run
// against, and why.
//
// It reached stderr only, through logger.Info, and `stickler lint --help`
// says "a tool whose requirements this tree does not meet is skipped rather
// than failed, and the skip is NAMED". It was named nowhere a machine reads
// -- not in the JSON, not in SARIF, not in the GitHub annotations. A
// consumer of a docs repository saw `{"results": []}` and exit 0, which is
// exactly what a passing gate looks like.
//
// [runner.Skipped] states the principle: a tool that did not run and a tool
// that found nothing produce the same silence, and the difference is the
// whole verdict. Carrying it here is what makes that true for the readers
// who are not people.
Skipped []SkippedRunner
}
Result aggregates every runner's findings and failures from one stickler pass.
func Orchestrate ¶
Orchestrate runs every runner concurrently to completion over root, collecting all diagnostics and wrapping any runner error with its name. One runner's failure never prevents the others from running, and the merged result is deterministic: diagnostics are grouped by runner order then sorted within the pass.
func (Result) Failed ¶
Failed reports whether the pass should fail the build: any runner error, or any diagnostic at all.
There is no third answer any more. A finding used to be able to be SOFT (reported, gating only past a committed count) or a PROBE (reported, never gating), and both were channels for lowering what the gate demanded -- one with a number attached and one without. The settings that opened them are refused at parse time, so a diagnostic that reaches here is a diagnostic that gates, and "the gate runs the full standard" is a property of this function rather than a promise made somewhere else.
type Root ¶
type Root string
Root is the directory or package pattern a runner analyzes (e.g. "./..." or a path); it is the target every Runner operates over.
type Runner ¶
type Runner interface {
Name() string
Run(ctx context.Context, root Root) ([]goyze.Diagnostic, error)
}
Runner executes one analyzer tool over a root directory and returns its findings as normalized diagnostics.
type SkippedRunner ¶ added in v0.15.0
SkippedRunner is one runner that did not run, and the requirement whose absence says so.