metrics

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package metrics computes verdict coverage over the analysistest corpora and renders it as a committed golden (metrics/metrics.json) plus a human-readable table (metrics/METRICS.md). Silence is a verdict: every source function is counted, budgeted or not.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncMetric

type FuncMetric struct {
	Pkg     string `json:"pkg"`
	Func    string `json:"func"`
	Verdict string `json:"verdict"` // "bounded" | "unverifiable"
	Bound   string `json:"bound,omitempty"`
	Cause   string `json:"cause,omitempty"` // CauseKind of causes[0]
}

FuncMetric is one function's verdict.

type PkgCount

type PkgCount struct {
	Total   int `json:"total"`
	Bounded int `json:"bounded"`
}

PkgCount aggregates one package.

type Report

type Report struct {
	Total       int                 `json:"total"`
	Bounded     int                 `json:"bounded"`
	CoveragePct string              `json:"coverage_pct"`
	ByCause     map[string]int      `json:"by_cause"`
	PerPackage  map[string]PkgCount `json:"per_package"`
	Functions   []FuncMetric        `json:"functions"`
	// Smells is the per-rule corpus fire count (drift alarm, NOT coverage).
	// A change in a rule's count is a behavior change and must be deliberate.
	Smells map[string]int `json:"smells"`
}

Report is the full coverage picture. Deterministic by construction: no timestamps, no toolchain versions, no absolute paths, sorted everything.

func Collect

func Collect(srcRoot string) (Report, error)

Collect analyzes every package under srcRoot (a GOPATH-shaped src dir).

func (Report) JSON

func (r Report) JSON() []byte

JSON renders the report as the committed golden: indented, sorted (Go's encoding/json sorts map keys), trailing newline.

func (Report) Markdown

func (r Report) Markdown() []byte

Markdown renders METRICS.md. GENERATED output — regenerate via task metrics.

Jump to

Keyboard shortcuts

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