Documentation
¶
Overview ¶
Package config loads .doclint.yaml: rule defaults/toggles, per-rule settings, ignore globs, and the declarative custom-rule block.
Index ¶
Constants ¶
const ConfigName = ".doclint.yaml"
ConfigName is the discovered file name.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶ added in v0.2.2
Validate checks a loaded config and returns the first problem as a clear, file-prefixed error. knownRules are the registered built-in rule names; custom rule IDs are added to the known set so enable/disable/settings may reference them. It runs at preflight, before the engine builds, so a malformed config fails fast with an actionable message instead of silently doing nothing.
Types ¶
type Config ¶
type Config struct {
Default string `yaml:"default"`
Enable []string `yaml:"enable"`
Disable []string `yaml:"disable"`
Settings map[string]RuleSetting `yaml:"settings"`
Ignore []string `yaml:"ignore"`
Paths []string `yaml:"paths"` // default lint/fmt targets when none given on the CLI
Custom []CustomRule `yaml:"custom"`
Dir string `yaml:"-"` // directory of the config file (relative-path base)
}
Config is the parsed .doclint.yaml plus the directory it was loaded from.
type CustomRule ¶
type CustomRule struct {
ID string `yaml:"id"`
Type string `yaml:"type"`
Glob string `yaml:"glob"`
Field string `yaml:"field"`
Fields []string `yaml:"fields"`
Min int `yaml:"min"`
Max int `yaml:"max"`
Pattern string `yaml:"pattern"`
SkipDrafts bool `yaml:"skip_drafts"`
Severity string `yaml:"severity"`
}
CustomRule is one declarative rule (mirrors rule.DeclSpec; kept decoupled so config has no dependency on package rule's internals).
type RuleSetting ¶
type RuleSetting struct {
Severity string `yaml:"severity"`
}
RuleSetting overrides a rule's defaults.