report

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package report turns probe and diff results into user-facing reports and writes them as table, json, markdown, sarif or GitHub annotations.

Index

Constants

This section is empty.

Variables

View Source
var Formats = []string{"table", "json", "markdown", "sarif", "github"}

Functions

func MarkShared

func MarkShared(c *Check, users map[string][]string, norm func(string) string)

MarkShared handles a single-app check: keys with no effect that come only from values files other Applications also load cannot be judged from this app alone. They are shown as SHARED, pointing at scan, and do not fail. users maps a normalized file path to the other Applications loading it.

func ResolveShared

func ResolveShared(cs []*Check)

ResolveShared handles values files loaded by several targets, such as a global values file passed to many charts: a key that has no effect in one chart but is used by another chart loading the same file is not reported.

Types

type Change

type Change struct {
	Key        string          `json:"key"`
	Path       []string        `json:"path"`
	Kind       string          `json:"kind"`
	From       string          `json:"from,omitempty"`
	To         string          `json:"to,omitempty"`
	Value      interface{}     `json:"value,omitempty"`
	OldDefault interface{}     `json:"oldDefault,omitempty"`
	NewDefault interface{}     `json:"newDefault,omitempty"`
	Detail     string          `json:"detail"`
	Origins    []values.Origin `json:"origins,omitempty"`
	Ignored    bool            `json:"ignored,omitempty"`
	// contains filtered or unexported fields
}

func (Change) Problem

func (c Change) Problem(failOn string) bool

Problem reports whether the change is at or above the failOn threshold.

type Check

type Check struct {
	App      string         `json:"app"`
	AppFile  string         `json:"appFile,omitempty"`
	Chart    string         `json:"chart"`
	Values   []string       `json:"values"`
	Renders  int64          `json:"renders"`
	Millis   int64          `json:"durationMs"`
	Noise    int            `json:"noisyFields"`
	Keys     []Key          `json:"keys"`
	Counts   map[string]int `json:"counts"`
	Ignored  int            `json:"ignored"`
	Shared   int            `json:"usedByOtherApps"`
	Notes    []string       `json:"notes,omitempty"`
	Unproven int            `json:"sharedUnverified"`
	Error    string         `json:"error,omitempty"`
}

func Failed

func Failed(app string, err error) *Check

func NewCheck

func NewCheck(app, appFile, chart string, set *values.Set, res *probe.Result, ignored func([]string) bool, took time.Duration) *Check

func (*Check) Problems

func (c *Check) Problems(failOn string) int

func (*Check) Restrict

func (c *Check) Restrict(files map[string]bool, norm func(string) string)

Restrict keeps only the keys set in one of files (normalized with norm) and recomputes the counts. Used when the user asked about specific values files, so keys coming from the app's other values files are left out.

type Diff

type Diff struct {
	App     string         `json:"app"`
	AppFile string         `json:"appFile,omitempty"`
	Chart   string         `json:"chart"`
	From    string         `json:"from"`
	To      string         `json:"to"`
	Values  []string       `json:"values"`
	Renders int64          `json:"renders"`
	Millis  int64          `json:"durationMs"`
	Changes []Change       `json:"changes"`
	Counts  map[string]int `json:"counts"`
	Error   string         `json:"error,omitempty"`
}

func FailedDiff

func FailedDiff(app string, err error) *Diff

func NewDiff

func NewDiff(app, appFile, chart, from, to string, set *values.Set, ts []diff.Transition, renders int64, ignored func([]string) bool, took time.Duration) *Diff

func (*Diff) Problems

func (d *Diff) Problems(failOn string) int

type Explain

type Explain struct {
	App     string           `json:"app"`
	Chart   string           `json:"chart"`
	Key     string           `json:"key"`
	Value   interface{}      `json:"value"`
	Changes []compare.Change `json:"changes"`
	Error   string           `json:"error,omitempty"`
}

type Key

type Key struct {
	Key     string          `json:"key"`
	Path    []string        `json:"path"`
	Status  string          `json:"status"`
	Value   interface{}     `json:"value"`
	Default interface{}     `json:"default,omitempty"`
	Detail  string          `json:"detail,omitempty"`
	Origins []values.Origin `json:"origins,omitempty"`
	Ignored bool            `json:"ignored,omitempty"`
	UsedBy  string          `json:"usedBy,omitempty"`
	// SharedWith lists other Applications loading the same values file when
	// only this app was analyzed: the key may be used by them.
	SharedWith []string `json:"sharedWith,omitempty"`
	// contains filtered or unexported fields
}

func (Key) Label

func (k Key) Label() string

Label is the status shown to the user.

func (Key) Problem

func (k Key) Problem(failOn string) bool

Problem reports whether the key is at or above the failOn threshold.

func (Key) Reportable

func (k Key) Reportable() bool

type Painter

type Painter struct{ On bool }

Painter adds ANSI colors when On. Padding is applied before coloring so escape codes never break column alignment.

func (Painter) Blue

func (p Painter) Blue(s string) string

func (Painter) Bold

func (p Painter) Bold(s string) string

func (Painter) Cyan

func (p Painter) Cyan(s string) string

func (Painter) Dim

func (p Painter) Dim(s string) string

func (Painter) Green

func (p Painter) Green(s string) string

func (Painter) Magenta

func (p Painter) Magenta(s string) string

func (Painter) Red

func (p Painter) Red(s string) string

func (Painter) Status

func (p Painter) Status(s string, width int) string

func (Painter) Yellow

func (p Painter) Yellow(s string) string

type Writer

type Writer struct {
	Out     io.Writer
	Format  string
	Paint   Painter
	Alive   bool
	Details bool
	BaseDir string
	Version string
}

func (*Writer) Checks

func (w *Writer) Checks(cs []*Check, scan bool) error

func (*Writer) Diffs

func (w *Writer) Diffs(ds []*Diff) error

func (*Writer) Explains

func (w *Writer) Explains(es []*Explain) error

func (*Writer) Rel

func (w *Writer) Rel(p string) string

Rel returns p relative to BaseDir with forward slashes, or p unchanged when no relative path exists (e.g. another drive on Windows).

Jump to

Keyboard shortcuts

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