lint

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

README

pkg/lint

Specification linting engine with pluggable rules. Validates spec trees for structural conventions.

Outstanding Questions

None at this time.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllRuleNames

func AllRuleNames() map[string]bool

AllRuleNames returns the canonical set of known rule names.

func RegisterChecker added in v0.3.3

func RegisterChecker(c Checker)

RegisterChecker registers a custom checker that will run alongside built-in checkers during Lint(). Must be called before any concurrent use of Lint (typically during init or program startup).

func ResetCustomCheckers added in v0.3.3

func ResetCustomCheckers()

ResetCustomCheckers clears all registered custom checkers (for testing).

func ValidateRuleNames

func ValidateRuleNames(names []string) error

ValidateRuleNames checks that all names are known rules.

Types

type Checker added in v0.3.3

type Checker interface {
	Name() string
	Severity() string
	Check(specRoot string) ([]Violation, error)
}

Checker is the public interface for custom rule implementations. External tools can implement this to add custom rules to the linter.

type Options

type Options struct {
	SpecRoot string
	Rules    []string // enabled rules; nil = all
	Ignore   []string // disabled rules
	Severity string   // minimum severity: error, warning, info
}

Options holds linting options.

type Violation

type Violation struct {
	File     string `json:"file" yaml:"file"`
	Line     int    `json:"line" yaml:"line"`
	Severity string `json:"severity" yaml:"severity"`
	Rule     string `json:"rule" yaml:"rule"`
	Message  string `json:"message" yaml:"message"`
}

Violation represents a single linting violation.

func FilterBySeverity

func FilterBySeverity(violations []Violation, minSeverity string) []Violation

FilterBySeverity filters violations to those at or above the minimum severity.

func Lint

func Lint(opts Options) ([]Violation, error)

Lint runs all enabled lint rules against the spec tree.

Jump to

Keyboard shortcuts

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