lint

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 12 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 BuildHubViewURL added in v0.5.0

func BuildHubViewURL(host string, r gitremote.Remote, relPath string) string

BuildHubViewURL returns the canonical Hub view URL for a feature README at relPath (relative to the project root, e.g. "spec/features/bots"). host is the Hub base URL without trailing slash.

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
	Fix      bool     // when true, auto-fixable violations are repaired on disk by checkers that support it
}

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 CheckIdeas added in v0.6.0

func CheckIdeas(specRoot string, fix bool) ([]Violation, error)

CheckIdeas runs all idea lint rules. If fix is true, auto-fixable violations are repaired on disk and omitted from the returned slice.

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