Documentation
¶
Overview ¶
Package config loads a per-project .godzilla.yaml so a repository can carry its scan policy in version control (CI-5): the gate threshold, path include/exclude filters (e.g. drop findings in test fixtures or generated code), and per-rule disable / severity overrides. CLI flags take precedence over file values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// FailOn is the gate threshold (info|low|medium|high|critical). A CLI
// -fail-on overrides it.
FailOn string `yaml:"fail-on"`
// Exclude drops findings whose file matches any of these path globs. Include,
// when non-empty, keeps only findings whose file matches one of them (applied
// before Exclude). Globs use '*' (within a path segment), '**' (across
// segments), and a bare name matches any path segment (so "testdata" matches
// any testdata/ directory).
Exclude []string `yaml:"exclude"`
Include []string `yaml:"include"`
Rules Rules `yaml:"rules"`
}
Config is the parsed .godzilla.yaml. Every field is optional.
func Load ¶
Load reads .godzilla.yaml (or .godzilla.yml) from root. When root is a file, its directory is used. It returns (nil, "", nil) when no config file exists — a missing config is not an error. The returned string is the path loaded.
func (*Config) ApplyRules ¶
ApplyRules returns a copy of rs with the config's disabled rules removed and severity overrides applied. It leaves rs untouched. Unknown rule IDs in the config are ignored (a rule may simply not be loaded).
func (*Config) FilterFindings ¶
FilterFindings marks findings excluded by the path filters as Suppressed (retained and flagged, consistent with baseline/inline-ignore — auditable, not silently deleted). root is the scan root, used to relativize finding paths for matching. It returns the findings and the number newly excluded.