report

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

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

func Formats

func Formats() []string

Formats lists the available format names, sorted.

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.

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
}

Data is everything a reporter needs to render a scan.

type Reporter

type Reporter interface {
	Format() string
	Render(w io.Writer, d Data) error
}

Reporter renders Data in one format.

func For

func For(format string) (Reporter, error)

For returns the reporter for a format name.

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.

Jump to

Keyboard shortcuts

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