Documentation
¶
Overview ¶
Package report renders a scan result in a chosen format. Each format is a Reporter over a common Data value, so the CLI (and, later, the branch diff) can emit console/markdown/HTML for humans, JUnit for CI test panels, and JSON/SARIF for machines through one interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Artifact ¶ added in v0.21.0
type Artifact struct {
Format string // the reporter format, e.g. "sarif"
Filename string // default base filename, e.g. "results.sarif"
ContentType string // MIME type, e.g. "application/sarif+json"
Bytes []byte // the rendered report
}
Artifact is a rendered report plus the metadata a publisher needs to deliver it: a default filename, a MIME content type, and the bytes. It is the unit a Publisher (pkg/publish) delivers to a destination.
func Build ¶ added in v0.21.0
func Build(cfg saga.ReportConfig, d Data) (Artifact, error)
Build renders a report as configured and returns it as an Artifact ready to publish. The "template" format renders a user-supplied Go text/template (cfg.Template / cfg.TemplateFile); all other formats use the built-in reporter registry. cfg.Filename overrides the default output filename.
func SBOMArtifacts ¶ added in v0.41.0
SBOMArtifacts converts SBOM documents into the unit publishers deliver, so SBOMs travel the same path as every other output rather than needing their own delivery mechanism.
type Data ¶
type Data struct {
Release saga.Release
Run engine.Result
Verdict norn.Result
MinPriority string
// TopN caps how many findings the console "Fix first" table shows: 0 uses the default,
// a negative value shows all, and a positive value shows that many. Ignored by other formats.
TopN int
// Compact strips what only a human reads — indentation and relayed rule prose — from the
// machine formats (json, sarif), for a consumer that acts on the report rather than reads
// it. The human formats ignore it: making those harder to read is the opposite of the point.
Compact bool
// Generated and Version stamp a report with when it ran and what produced it. A report
// offered as evidence has to answer both; a reader who cannot tell whether they are looking
// at today's scan or last quarter's has nothing they can rely on. Zero values are omitted,
// so a caller that does not set them still renders a valid report.
Generated time.Time
Version string
}
Data is everything a reporter needs to render a scan.
type TemplateFinding ¶ added in v0.21.0
type TemplateFinding struct {
Priority string
Level string
Score string
Control string
Tool string
RuleID string
Message string
Location string
}
TemplateFinding is one finding as exposed to a template.
type TemplateView ¶ added in v0.21.0
type TemplateView struct {
Release saga.Release
Verdict string // "pass" | "fail"
Pass bool
Priorities struct{ P1, P2, P3, P4 int }
Controls []norn.ControlOutcome
Findings []TemplateFinding // ranked most-urgent first
}
TemplateView is the data model a "template" report renders against. It is the documented, stable surface for custom templates — a friendly, flattened view of a scan (no engine internals), leading with the verdict and prioritized findings.