quality

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package quality runs read-only coverage and verification checks for a local repository fleet. It deliberately reports every selected repository instead of stopping at the first failure, so people and AI agents can act on one complete index.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortVerificationReports

func SortVerificationReports(reports []VerificationReport)

SortVerificationReports orders reports for deterministic output.

Types

type Check

type Check string

Check selects a conventional verification class.

const (
	CheckLint  Check = "lint"
	CheckTest  Check = "test"
	CheckBuild Check = "build"
	CheckSpec  Check = "spec"
)

func ParseChecks

func ParseChecks(value string) ([]Check, error)

ParseChecks validates the explicit --checks list. A missing list defaults to the conventional lint, test, build sequence.

type CoverageReport

type CoverageReport struct {
	SchemaVersion int                  `yaml:"schema_version" json:"schema_version"`
	Repositories  []RepositoryCoverage `yaml:"repositories" json:"repositories"`
	Statements    int                  `yaml:"statements" json:"statements"`
	Covered       int                  `yaml:"covered" json:"covered"`
	Percentage    float64              `yaml:"percentage" json:"percentage"`
}

CoverageReport is a deterministic, machine-readable coverage index.

func NewCoverageReport

func NewCoverageReport(repositories []RepositoryCoverage) CoverageReport

NewCoverageReport aggregates reports in deterministic repository order.

type ModuleCoverage

type ModuleCoverage struct {
	Path       string  `yaml:"path" json:"path"`
	Statements int     `yaml:"statements" json:"statements"`
	Covered    int     `yaml:"covered" json:"covered"`
	Percentage float64 `yaml:"percentage" json:"percentage"`
	Attempts   int     `yaml:"attempts,omitempty" json:"attempts,omitempty"`
}

ModuleCoverage records the statement totals from one Go module's generated coverage profile.

type RepositoryCoverage

type RepositoryCoverage struct {
	Repository string           `yaml:"repository" json:"repository"`
	Path       string           `yaml:"path" json:"path"`
	Status     Status           `yaml:"status" json:"status"`
	Modules    []ModuleCoverage `yaml:"modules,omitempty" json:"modules,omitempty"`
	Statements int              `yaml:"statements" json:"statements"`
	Covered    int              `yaml:"covered" json:"covered"`
	Percentage float64          `yaml:"percentage" json:"percentage"`
	Error      string           `yaml:"error,omitempty" json:"error,omitempty"`
}

RepositoryCoverage records aggregate Go coverage for one repository.

func Cover

func Cover(ctx context.Context, repository, path string) RepositoryCoverage

Cover measures all Go modules below path. It creates profiles in the system temporary directory, never in the repository.

func CoverWithOptions

func CoverWithOptions(ctx context.Context, repository, path string, options RunOptions) RepositoryCoverage

CoverWithOptions measures coverage with a deadline and retries for each Go module's test command.

type RunOptions

type RunOptions struct {
	Timeout time.Duration
	Retry   int
}

RunOptions bounds a single external command and retries only failed attempts. Zero Timeout disables the per-command deadline.

type Status

type Status string

Status is the outcome of a repository or a discrete verification command.

const (
	StatusPassed  Status = "passed"
	StatusFailed  Status = "failed"
	StatusSkipped Status = "skipped"
)

type VerificationEntry

type VerificationEntry struct {
	Language string `yaml:"language" json:"language"`
	Module   string `yaml:"module,omitempty" json:"module,omitempty"`
	Check    Check  `yaml:"check" json:"check"`
	Command  string `yaml:"command,omitempty" json:"command,omitempty"`
	Status   Status `yaml:"status" json:"status"`
	Detail   string `yaml:"detail,omitempty" json:"detail,omitempty"`
	Attempts int    `yaml:"attempts,omitempty" json:"attempts,omitempty"`
}

VerificationEntry is one command WB attempted or intentionally skipped.

type VerificationReport

type VerificationReport struct {
	Repository string              `yaml:"repository" json:"repository"`
	Path       string              `yaml:"path" json:"path"`
	Status     Status              `yaml:"status" json:"status"`
	Results    []VerificationEntry `yaml:"results" json:"results"`
}

VerificationReport records all conventional checks applicable to a repository. Unsupported stacks and missing optional Node scripts are skipped rather than treated as failures.

func Verify

func Verify(ctx context.Context, repository, path string, checks []Check) VerificationReport

Verify runs the requested conventional Go and Node checks. The caller owns cross-repository parallelism; checks within one module run in the requested order to keep output and failures clear.

func VerifyWithOptions

func VerifyWithOptions(ctx context.Context, repository, path string, checks []Check, options RunOptions) VerificationReport

VerifyWithOptions runs the requested checks with per-command reliability controls. The returned report includes every attempted, skipped, passed, or failed command.

Jump to

Keyboard shortcuts

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