Documentation
¶
Overview ¶
Package config handles loading configuration from .gonerc.yaml files.
Index ¶
- Constants
- type CheckConfig
- type Config
- func (c *Config) GetShowDead() bool
- func (c *Config) GetShowWarnings() bool
- func (c *Config) HasCheckConfig() bool
- func (c *Config) HasIgnoreRules() bool
- func (c *Config) HasOutputConfig() bool
- func (c *Config) HasScanConfig() bool
- func (c *Config) HasTypes() bool
- func (c *Config) IsEmpty() bool
- func (c *Config) Merge(other *Config)
- func (c *Config) Validate() error
- type IgnoreConfig
- type OutputConfig
- type ScanConfig
Constants ¶
const DefaultConfigFileName = ".gonerc.yaml"
DefaultConfigFileName is the default configuration file name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckConfig ¶ added in v0.1.3
type CheckConfig struct {
// Concurrency is the number of concurrent workers.
// Default: 50 (set at runtime if 0)
Concurrency int `yaml:"concurrency"`
// Timeout is the request timeout in seconds.
// Default: 5 (set at runtime if 0)
Timeout int `yaml:"timeout"`
// Retries is the number of retry attempts for failed requests.
// Default: 1 (set at runtime if 0)
Retries int `yaml:"retries"`
// Strict fails on malformed files instead of skipping them.
// Default: false
Strict bool `yaml:"strict"`
}
CheckConfig holds checker settings for URL validation.
type Config ¶
type Config struct {
// Types specifies which file types to scan.
// Supported: md, json, yaml, toml, xml
// If empty, defaults to ["md"] at runtime.
Types []string `yaml:"types"`
// Scan holds scanner configuration.
Scan ScanConfig `yaml:"scan"`
// Check holds checker configuration.
Check CheckConfig `yaml:"check"`
// Output holds output preferences.
Output OutputConfig `yaml:"output"`
// Ignore holds URL ignore rules (backwards compatible).
Ignore IgnoreConfig `yaml:"ignore"`
}
Config represents the complete configuration structure.
func FindAndLoad ¶
FindAndLoad searches for a config file starting from the given directory and walking up to parent directories until it finds one or reaches root. This allows project-specific configs to be found from subdirectories.
func Load ¶
Load reads configuration from .gonerc.yaml in the current directory. Returns an empty config if the file doesn't exist (not an error). Returns an error only if the file exists but cannot be parsed.
func LoadFrom ¶
LoadFrom reads configuration from a specific path. Returns an empty config if the file doesn't exist (not an error). Returns an error only if the file exists but cannot be parsed.
func (*Config) GetShowDead ¶ added in v0.1.3
GetShowDead returns the ShowDead value, defaulting to true if not set.
func (*Config) GetShowWarnings ¶ added in v0.1.3
GetShowWarnings returns the ShowWarnings value, defaulting to true if not set.
func (*Config) HasCheckConfig ¶ added in v0.1.3
HasCheckConfig returns true if any check configuration is set.
func (*Config) HasIgnoreRules ¶ added in v0.1.3
HasIgnoreRules returns true if any ignore rules are defined.
func (*Config) HasOutputConfig ¶ added in v0.1.3
HasOutputConfig returns true if any output configuration is set.
func (*Config) HasScanConfig ¶ added in v0.1.3
HasScanConfig returns true if any scan configuration is set.
func (*Config) IsEmpty ¶
IsEmpty returns true if the config has no settings defined. This checks all configuration sections, not just ignore rules.
type IgnoreConfig ¶
type IgnoreConfig struct {
// Domains to ignore (automatically includes subdomains).
// Example: "example.com" will also match "www.example.com", "api.example.com".
Domains []string `yaml:"domains"`
// Patterns are glob patterns for URL matching.
// Example: "*.local/*", "*/internal/*"
Patterns []string `yaml:"patterns"`
// Regex are regular expression patterns for URL matching.
// Example: ".*\\.test$", ".*/v[0-9]+/draft/.*"
Regex []string `yaml:"regex"`
}
IgnoreConfig holds all ignore rules.
type OutputConfig ¶ added in v0.1.3
type OutputConfig struct {
// Format specifies the default output format.
// Valid: json, yaml, xml, junit, markdown
// Empty means text output to stdout.
Format string `yaml:"format"`
// ShowAlive shows alive links in output.
// Default: false
ShowAlive bool `yaml:"showAlive"`
// ShowWarnings shows warning links (redirects, blocked) in output.
// Default: true (set at runtime)
ShowWarnings *bool `yaml:"showWarnings"`
// ShowDead shows dead links and errors in output.
// Default: true (set at runtime)
ShowDead *bool `yaml:"showDead"`
// ShowStats shows performance statistics.
// Default: false
ShowStats bool `yaml:"showStats"`
}
OutputConfig holds output preferences for the check command.
type ScanConfig ¶ added in v0.1.3
type ScanConfig struct {
// Include specifies glob patterns for paths to include.
// If empty, all files matching the types are included.
// Example: ["docs/**", "README.md"]
Include []string `yaml:"include"`
// Exclude specifies glob patterns for paths to exclude.
// Example: ["node_modules/**", "vendor/**", "**/testdata/**"]
Exclude []string `yaml:"exclude"`
}
ScanConfig holds scanner settings for file discovery.