report

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package report renders a Verdict into one of three formats: human (TTY table), agent (verdict-first, compact, machine-scannable), or json (versioned stable schema). Nothing here touches stdin/stdout globals — callers pass an io.Writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Explain

func Explain(w io.Writer, v domain.Verdict, id string) (found bool, err error)

Explain prints the full detail of one finding — used by `gauntlet check --explain <id>` so the compact agent format can stay compact.

Writes to w. Returns an error only on the IO write path; a missing id is signalled by a non-nil `notFound` result.

func HintFor

func HintFor(f domain.Finding) string

HintFor returns the fix hint for a finding, or empty string if no hint matches. Rule is checked with a couple of fallbacks (bare gate name for generic hints) so we get partial coverage even without an exhaustive table.

Types

type Format

type Format string

Format is the output selector.

const (
	FormatHuman  Format = "human"
	FormatAgent  Format = "agent"
	FormatJSON   Format = "json"
	FormatGithub Format = "github"
)

type Formatter

type Formatter interface {
	Write(w io.Writer, v domain.Verdict) error
}

Formatter renders a Verdict to `w`. Implementations must never call os.Exit; the caller owns exit codes.

func For

func For(f Format) (Formatter, error)

For returns the formatter for the given format string with default options.

func ForWithOptions

func ForWithOptions(f Format, opts Options) (Formatter, error)

ForWithOptions returns a formatter, honoring the given options.

type Options

type Options struct {
	// MaxFindings caps the ranked finding list in --format agent. Overflow
	// is announced but never truncated mid-line. 0 = use defaultMaxFindings.
	MaxFindings int
}

Options tune formatter behavior. Zero-value means "use defaults."

Jump to

Keyboard shortcuts

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