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"`
Fmt FmtConfig `yaml:"fmt"` // `fmt` command formatting-pass options
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 FmtConfig ¶ added in v0.7.5
type FmtConfig struct {
ShortcodeIndent ShortcodeIndentConfig `yaml:"shortcode_indent"`
}
FmtConfig configures the `fmt` command's formatting passes.
type RuleSetting ¶
type RuleSetting struct {
Severity string `yaml:"severity"`
}
RuleSetting overrides a rule's defaults.
type ShortcodeIndentConfig ¶ added in v0.7.5
type ShortcodeIndentConfig struct {
Enabled *bool `yaml:"enabled"` // run the pass at all (default true)
IndentWidth *int `yaml:"indent_width"` // spaces per nesting level (default 2)
Exclude []string `yaml:"exclude"` // shortcode names whose subtree is left verbatim
}
ShortcodeIndentConfig configures the shortcode-indent formatting pass, which re-indents Hugo shortcode tags opened inline in a list item to align with the item's continuation content. Pointer fields distinguish "unset" (use the default) from an explicit value.
func (ShortcodeIndentConfig) ExcludeSet ¶ added in v0.7.5
func (c ShortcodeIndentConfig) ExcludeSet() map[string]bool
ExcludeSet returns the excluded shortcode names as a set, or nil if none.
func (ShortcodeIndentConfig) IsEnabled ¶ added in v0.7.5
func (c ShortcodeIndentConfig) IsEnabled() bool
IsEnabled reports whether the shortcode-indent pass should run.
func (ShortcodeIndentConfig) Width ¶ added in v0.7.5
func (c ShortcodeIndentConfig) Width() int
Width returns the per-nesting-level indent width in spaces, clamped to a sane default when unset or negative.