gates

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package gates defines the Gate contract every tool wrapper implements. Individual gates live in sub-packages (gates/gofumpt, gates/golangci, …).

Index

Constants

This section is empty.

Variables

View Source
var ErrToolMissing = errors.New("gauntlet: required tool not installed")

ErrToolMissing is a distinct sentinel so gates can SKIP visibly instead of FAILing when their underlying binary isn't installed.

View Source
var ErrUnknownGate = errUnknownGate{}

ErrUnknownGate is returned by Lookup for names not in the registry.

Functions

func Names

func Names() []string

Names returns every registered gate name, sorted, for `gauntlet gates` and help output.

func Register

func Register(g Gate)

Register adds a gate to the process-wide registry. Panics on duplicate name — that's a programmer error caught at startup, not runtime.

func ResolveTool

func ResolveTool(name string) (string, error)

ResolveTool wraps exec.LookPath and returns ErrToolMissing on miss so gates can distinguish "tool absent" from "tool ran and failed".

Types

type Gate

type Gate interface {
	// Name is the stable identifier used in config, filtering, and reports.
	Name() string
	// Run executes the gate against the repo rooted at `root`. It returns
	// a GateResult even on failure; a returned error means the gate itself
	// broke in an unexpected way (not a finding).
	Run(ctx context.Context, root string) (domain.GateResult, error)
	// LineScoped reports whether findings from this gate can be filtered
	// against a diff. Whole-run gates (test/build) return false.
	LineScoped() bool
}

Gate is the interface every quality-gate implementation must satisfy. Implementations are stateless — one gate value per process is fine.

func Lookup

func Lookup(name string) (Gate, error)

Lookup returns the gate with the given name, or ErrUnknownGate.

Directories

Path Synopsis
Package customgate implements a generic Gate that runs an arbitrary command and parses its output via a built-in parser kind.
Package customgate implements a generic Gate that runs an arbitrary command and parses its output via a built-in parser kind.
Package eslint wraps `<pm exec> eslint --format json .`.
Package eslint wraps `<pm exec> eslint --format json .`.
Package gobuild wraps `go build ./...`.
Package gobuild wraps `go build ./...`.
Package gofumpt wraps `gofumpt -l` as a gauntlet gate.
Package gofumpt wraps `gofumpt -l` as a gauntlet gate.
Package golangci wraps `golangci-lint run --out-format json`.
Package golangci wraps `golangci-lint run --out-format json`.
Package gotest wraps `go test -json -race ./...`.
Package gotest wraps `go test -json -race ./...`.
Package govet wraps `go vet ./...`.
Package govet wraps `go vet ./...`.
Package jslint holds the shared ESLint-style JSON parser used by both the eslint and oxlint gates — they emit the same array-of-file-results shape.
Package jslint holds the shared ESLint-style JSON parser used by both the eslint and oxlint gates — they emit the same array-of-file-results shape.
Package oxlint wraps oxlint as a gauntlet gate.
Package oxlint wraps oxlint as a gauntlet gate.
Package prettier wraps `<pm> exec prettier --check --list-different .`.
Package prettier wraps `<pm> exec prettier --check --list-different .`.
Package tsbuild runs the repo's `build` script (`<pm> run build`).
Package tsbuild runs the repo's `build` script (`<pm> run build`).
Package tsc wraps `<pm exec> tsc --noEmit --pretty false`.
Package tsc wraps `<pm exec> tsc --noEmit --pretty false`.
Package vitest wraps `<pm exec> vitest run --reporter=json`.
Package vitest wraps `<pm exec> vitest run --reporter=json`.

Jump to

Keyboard shortcuts

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