lint

package
v0.22.148 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package lint — auto-lint guardrails after Edit/Write (ADR-014 T2, design from the 2026-04-26 multi-CLI fan-out).

One Runner exposes a single Lint(ctx, path) method that picks the right adapter by file extension, shells out to the upstream linter, parses its JSON output, and returns structured findings. Edit / Write call the runner immediately after a successful atomic write so findings ride back in the same response — agents self-correct in the next turn without an async queue.

Per ADR-007: every adapter wraps a maintained linter (golangci-lint, eslint, ruff). Adding a language is one new file, zero changes to the runner contract.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("lint: unsupported language")

ErrUnsupported is reserved for future use; currently Lint returns nil/nil for unsupported extensions rather than erroring (graceful skip per the spec). Kept exported in case a stricter mode wants it.

Functions

func IsEnabled

func IsEnabled(enabledPtr *bool) bool

IsEnabled is the helper Edit/Write call to read config.AutoLint. Default = true (nil pointer means default-on per the config schema).

Types

type Finding

type Finding struct {
	LineNumber int    `json:"line_number"`
	Column     int    `json:"column"`
	Severity   string `json:"severity"` // "error" | "warning" | "info"
	Tool       string `json:"tool"`     // golangci-lint | eslint | ruff
	Message    string `json:"message"`
}

Finding is one issue the linter reported. Same shape across every language so callers never branch on the linter that produced it.

type Runner

type Runner interface {
	Lint(ctx context.Context, path string) ([]Finding, error)
}

Runner walks a single file path through the language adapter that matches its extension. Implementations must be safe to call concurrently from many Edit/Write invocations.

func Disabled

func Disabled() Runner

Disabled returns a Runner that does nothing — used when config.AutoLint.Enabled is explicitly false.

func New

func New() Runner

New returns a Runner pre-wired with the three v0.14 adapters (Go / JS-TS / Python). Adapters whose binary is missing on PATH silently no-op for that language — the runner doesn't crash a normal Edit when the operator hasn't installed every linter.

Jump to

Keyboard shortcuts

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