report

package
v0.0.0-...-527d7fd Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Histogram

func Histogram(values []float64, buckets []float64) string

Histogram produces a simple text histogram of value distribution.

func WriteJSON

func WriteJSON(w io.Writer, r Report) error

WriteJSON writes a machine-readable JSON report.

func WriteText

func WriteText(w io.Writer, r Report)

WriteText writes a human-readable text report.

Types

type Finding

type Finding struct {
	File     string   `json:"file"`
	Line     int      `json:"line,omitempty"`
	Function string   `json:"function,omitempty"`
	Message  string   `json:"message"`
	Value    float64  `json:"value"`
	Limit    float64  `json:"limit,omitempty"`
	Severity Severity `json:"severity"`
}

Finding represents a single metric violation or observation.

func TopFindings

func TopFindings(findings []Finding, n int) []Finding

TopFindings returns the top N findings sorted by value descending.

type Report

type Report struct {
	Sections []Section `json:"sections"`
}

Report is the top-level output.

func (Report) WorstSeverity

func (r Report) WorstSeverity() Severity

WorstSeverity returns the worst severity across all sections.

type Section

type Section struct {
	Name     string    `json:"name"`
	Summary  string    `json:"summary"`
	Severity Severity  `json:"severity"`
	Findings []Finding `json:"findings,omitempty"`
	Stats    any       `json:"stats,omitempty"`
}

Section represents one metric category in the report.

type Severity

type Severity string

Severity indicates the level of a finding.

const (
	SeverityPass Severity = "PASS"
	SeverityWarn Severity = "WARN"
	SeverityFail Severity = "FAIL"
)

Jump to

Keyboard shortcuts

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