Documentation
¶
Overview ¶
Package output renders findings for people and for machines.
Index ¶
Constants ¶
const SchemaVersion = 1
SchemaVersion is the current JSON schema version.
Variables ¶
This section is empty.
Functions ¶
func ColourEnabled ¶
ColourEnabled reports whether ANSI styling is appropriate for a stream, honouring the NO_COLOR convention (https://no-color.org).
func JSON ¶
JSON writes the report. Findings is never null in the output: an empty run produces `[]`, so consumers can iterate without a nil check.
func RulesMarkdown ¶
func RulesMarkdown() string
RulesMarkdown renders the rule reference.
It is generated from the same metadata the engine uses, so the published documentation cannot drift from what the code does. That is the payoff for keeping the citation and rationale in the rule struct rather than in a separate document someone has to remember to update.
Types ¶
type Human ¶
type Human struct {
// Colour enables ANSI styling. Callers should set it from a terminal
// check and the NO_COLOR convention.
Colour bool
// Verbose includes each rule's rationale and citation, for a user meeting
// a rule for the first time.
Verbose bool
}
Human renders findings grouped by unit, with colour when the destination is a terminal that wants it.
type Report ¶
type Report struct {
// Version is the schema version, so consumers can detect a breaking
// change rather than guessing.
Version int `json:"version"`
// Findings are ordered deterministically: by unit, then line, then rule.
Findings []rules.Finding `json:"findings"`
// Summary counts findings by severity, so a consumer need not aggregate.
Summary Summary `json:"summary"`
}
Report is the stable JSON schema. It is a published contract: fields may be added, but existing ones do not change meaning or type.