Documentation
¶
Overview ¶
Package linter provides the shared lint pipeline used by both the CLI and the LSP server.
The pipeline: config discovery → parse → semantic model → rule execution → violation collection. Callers use LintFile to run the pipeline and then apply their own processor chain (via CLIProcessors or LSPProcessors) to filter and transform the results.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CLIProcessors ¶
func CLIProcessors() (*processor.Chain, *processor.InlineDirectiveFilter)
CLIProcessors returns the standard CLI processor chain and the inline directive filter (the caller needs it for processor.InlineDirectiveFilter.AdditionalViolations).
func EnabledRuleCodes ¶
EnabledRuleCodes returns the set of rule codes that are active for the given config. Includes registered rules, BuildKit captured rules, and semantic construction rules.
func LSPProcessors ¶
LSPProcessors returns the LSP processor chain. The LSP chain omits path normalization, path exclusion, and snippet attachment since those are CLI-specific concerns.
Types ¶
type Channel ¶
type Channel interface {
Log(level Level, msg string)
Progress(title string, pct int) // -1 = indeterminate
Warn(msg string)
}
Channel receives diagnostic output from the lint/fix pipeline. Implementations map to environment-specific UX (LSP notifications, CLI stderr, etc.).
type Input ¶
type Input struct {
// FilePath is used for config discovery and violation locations.
FilePath string
// Content is the file content to lint. If nil, LintFile reads from FilePath.
Content []byte
// Config is the resolved configuration. If nil, LintFile loads from FilePath.
Config *config.Config
// BuildContext provides context-aware checks (e.g. .dockerignore).
// If nil, context-aware checks are skipped.
BuildContext rules.BuildContext
// Channel receives progress and diagnostic output. Nil means silent.
Channel Channel
}
Input configures a single invocation of LintFile.
type Result ¶
type Result struct {
// Violations are raw violations before processor filtering.
Violations []rules.Violation
// AsyncPlan contains planned async check requests from AsyncRule implementations.
// The caller is responsible for executing these (if slow checks are enabled).
AsyncPlan []async.CheckRequest
// ParseResult is the parsed Dockerfile (AST, stages, source, BuildKit warnings).
ParseResult *dockerfile.ParseResult
// Config is the resolved config (loaded or passed in via Input).
Config *config.Config
}
Result contains the output of LintFile.