domain

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package domain holds the shared types every layer speaks: findings, gate results, verdicts. Nothing outside stdlib is imported here — this package is the leaf of the import graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Gate     string   `json:"gate"`
	Severity Severity `json:"severity"`
	File     string   `json:"file,omitempty"`
	Line     int      `json:"line,omitempty"`
	Column   int      `json:"column,omitempty"`
	Rule     string   `json:"rule,omitempty"`
	Message  string   `json:"message"`
	// PreExisting is set by the engine after diff scoping; a raw finding
	// from a parser has this false.
	PreExisting bool `json:"pre_existing,omitempty"`
	// ID is a deterministic synthetic identifier used by
	// `gauntlet check --explain <id>`. Set by the engine.
	ID string `json:"id,omitempty"`
}

Finding is one discrete quality-gate hit: a lint issue, test failure, build error. File/Line are optional (whole-package findings set Line=0).

func (Finding) ComputeID

func (f Finding) ComputeID() string

ComputeID returns the stable synthetic id for a Finding:

<gate>:<file>:<line>:<rule>

Empty file/rule collapse to `-` so ids stay parseable.

type GateResult

type GateResult struct {
	Name       string        `json:"name"`
	Status     GateStatus    `json:"status"`
	Findings   []Finding     `json:"findings,omitempty"`
	Duration   time.Duration `json:"duration_ms"`
	SkipReason string        `json:"skip_reason,omitempty"`
	// LineScoped is true when the gate's findings can be filtered by
	// changed line ranges. Test/build findings set this false — a test
	// broken by your change can live in an untouched file.
	LineScoped bool `json:"-"`
}

GateResult is what a gate returns; whole-run status plus findings.

type GateStatus

type GateStatus int

GateStatus is the outcome of a single gate run.

const (
	GateOK   GateStatus = iota // ran, no findings
	GateFail                   // ran, produced findings
	GateSkip                   // did not run (tool missing, disabled by config)
)

func (GateStatus) String

func (g GateStatus) String() string

type Severity

type Severity int

Severity ranks how bad a finding is. Higher constant = more severe. Used for stable sorting in reports.

const (
	SevInfo Severity = iota
	SevWarn
	SevError
	SevFatal
)

func (Severity) String

func (s Severity) String() string

type Verdict

type Verdict struct {
	Status        GateStatus   `json:"status"`
	NewFindings   []Finding    `json:"new_findings"`
	PreExisting   int          `json:"pre_existing_count"`
	Gates         []GateResult `json:"gates"`
	Scope         string       `json:"scope"` // "staged" | "since:<ref>" | "whole-tree"
	SchemaVersion string       `json:"schema"`
}

Verdict is the top-level result the engine returns. The verdict line rendered in reports is a direct read of these counters — tests assert them exactly.

func (Verdict) HasNewFindings

func (v Verdict) HasNewFindings() bool

HasNewFindings is the definitive "should we FAIL?" check.

Jump to

Keyboard shortcuts

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