Documentation
¶
Overview ¶
Package lint is the extensible content-pack lint surface. Consumers register `Linter` implementations against a `Registry`, then call `Run` to collect `Findings`. Severity-Error findings fail the `forge content lint` exit code and (when wired) the pack build.
Domain-specific lints live in the consumer (mmo-game registers "no reaction-window < 200ms", loot-table-sum > 0, ref-integrity, etc.); this kit owns the registry, severity routing, and runner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicateName = errors.New("lint: linter with that name already registered")
ErrDuplicateName is returned by Register when another linter with the same Name() is already installed.
Functions ¶
This section is empty.
Types ¶
type Finding ¶
type Finding struct {
Severity Severity
Entry string // pack-relative path, or "" for pack-wide
Code string // short stable identifier (used in CLI summaries)
Message string
}
Finding is one diagnostic produced by a Linter.
type Findings ¶
type Findings []Finding
Findings is the result list. Methods give CLI runners helpful shortcuts.
func RunPackDir ¶
RunPackDir loads the pack at dir and runs r against it. Convenience wrapper for the `forge content lint <dir>` CLI surface.
type Linter ¶
type Linter interface {
// Name is a stable identifier used in CLI summaries.
Name() string
// Lint is the actual check.
Lint(ctx context.Context, pack *content.Pack) Findings
}
Linter checks one pack and returns Findings. Implementations should be pure — no I/O beyond reading the pack itself.
type LinterFunc ¶
LinterFunc adapts a function (plus a name) to Linter.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry composes multiple Linters.
func (*Registry) MustRegister ¶
MustRegister panics on error.