customgate

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: 14 Imported by: 0

Documentation

Overview

Package customgate implements a generic Gate that runs an arbitrary command and parses its output via a built-in parser kind. Users wire this in via .gauntlet.yml's `custom_gates:` map — no plugin binaries, no network, no SaaS. Any tool with machine-readable output becomes a gate.

Index

Constants

View Source
const (
	ParserJSONFindings = "json-findings"
	ParserFileLineCol  = "file-line-col"
	ParserExitCodeOnly = "exit-code-only"
	ParserGitHub       = "github-annotations"
)

ParserKind names the built-in parsers.

Variables

This section is empty.

Functions

func ParseExitCode

func ParseExitCode(gate string, exitCode int, stderr []byte) []domain.Finding

ParseExitCode maps an exit code + stderr to a single Finding when the command failed. Zero exit = no findings. Used for tools without structured output (e.g. `terraform fmt -check`).

func ParseFileLineCol

func ParseFileLineCol(gate string, raw []byte) ([]domain.Finding, error)

ParseFileLineCol reads stderr/stdout in the standard Go/tsc-style line format. Non-matching lines are skipped (progress noise / blank lines).

func ParseGitHubAnnotations

func ParseGitHubAnnotations(gate string, raw []byte) ([]domain.Finding, error)

ParseGitHubAnnotations reads GitHub workflow command annotations. Ordinary output is ignored so progress and summary lines can surround findings.

func ParseJSONFindings

func ParseJSONFindings(gate string, raw []byte) ([]domain.Finding, error)

ParseJSONFindings reads either a bare `[{file,line,...}]` array or a `{findings:[...]}` wrapper. Same shape as gauntlet's own JSON output.

Types

type Gate

type Gate struct {
	// contains filtered or unexported fields
}

Gate implements gates.Gate for user-defined tools declared in `.gauntlet.yml`'s custom_gates map.

func New

func New(name string, cfg config.CustomGate) (*Gate, error)

New constructs a Gate for the given name + config. Returns error if the config is malformed (unknown parser kind or invalid process definition).

func (*Gate) LineScoped

func (g *Gate) LineScoped() bool

func (*Gate) Name

func (g *Gate) Name() string

func (*Gate) Run

func (g *Gate) Run(ctx context.Context, root string) (domain.GateResult, error)

Jump to

Keyboard shortcuts

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