Help us shape the future of Go! Take the 2026 Go Developer Survey

report

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package report defines the validated, deterministic lintpal.report.v1 artifact.

Index

Constants

View Source
const SchemaVersion = "lintpal.report.v1"

Variables

View Source
var ErrExport = errors.New("lint report export failed")
View Source
var ErrGate = errors.New("lint severity gate failed")
View Source
var ErrInvalidFormat = errors.New("invalid lint report format")
View Source
var ErrInvalidReport = errors.New("invalid lint report")
View Source
var ErrInvalidThreshold = errors.New("invalid lint severity threshold")

Functions

func MeetsGate

func MeetsGate(artifact Report, threshold Threshold) (bool, error)

func Validate

func Validate(report Report) error

Validate checks the public artifact before it is rendered or gated. Exact changed-line provenance is checked by New, which has the Git work items.

func WriteAndGate

func WriteAndGate(writer io.Writer, artifact Report, format Format, threshold Threshold) error

func WriteHuman

func WriteHuman(writer io.Writer, artifact Report) error

func WriteJSON

func WriteJSON(writer io.Writer, artifact Report) error

Types

type Diagnostic

type Diagnostic struct {
	RuleID     string         `json:"rule_id"`
	WorkItemID string         `json:"work_item_id"`
	Severity   rules.Severity `json:"severity"`
	Path       string         `json:"path"`
	Side       git.Side       `json:"side"`
	StartLine  int            `json:"start_line"`
	EndLine    int            `json:"end_line"`
	Title      string         `json:"title"`
	Message    string         `json:"message"`
	Provider   string         `json:"provider"`
	Model      string         `json:"model"`
	Evidence   Evidence       `json:"evidence"`
}

type Evidence

type Evidence struct {
	Kind       string   `json:"kind"`
	Value      float64  `json:"value"`
	Confidence *float64 `json:"confidence,omitempty"`
}

type Format

type Format string
const (
	JSON  Format = "json"
	Human Format = "human"
)

type Report

type Report struct {
	SchemaVersion string       `json:"schema_version"`
	BaseSHA       string       `json:"base_sha"`
	HeadSHA       string       `json:"head_sha"`
	MergeBaseSHA  string       `json:"merge_base_sha"`
	Diagnostics   []Diagnostic `json:"diagnostics"`
	Skips         []Skip       `json:"skips"`
	Stats         Stats        `json:"stats"`
}

func New

func New(result git.Result, decisions []rules.Decision, provider, model string, stats Stats) (Report, error)

New checks every decision against the original changed-line work items.

type Skip

type Skip struct {
	OldPath string         `json:"old_path,omitempty"`
	NewPath string         `json:"new_path,omitempty"`
	Reason  git.SkipReason `json:"reason"`
}

type Stats

type Stats struct {
	WorkItems    int `json:"work_items"`
	Skipped      int `json:"skipped"`
	Groups       int `json:"groups"`
	Batches      int `json:"batches"`
	Questions    int `json:"questions"`
	Diagnostics  int `json:"diagnostics"`
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
}

type Threshold

type Threshold string
const (
	None     Threshold = "none"
	Low      Threshold = "low"
	Medium   Threshold = "medium"
	High     Threshold = "high"
	Critical Threshold = "critical"
)

Jump to

Keyboard shortcuts

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