Documentation
¶
Overview ¶
Package config owns typed Glippy configuration defaults and decoding.
Index ¶
Constants ¶
const ( // Filename is the canonical project configuration filename. Filename = ".glippy.toml" // LegacyFilename is accepted as a deprecated fallback for the v0.2 compatibility window. LegacyFilename = ".gox.toml" // MaxAnalysisTargets bounds explicit CI build-matrix work from configuration. MaxAnalysisTargets = 32 )
const ( // DefaultLineWidth is the formatter's default print width. DefaultLineWidth = 100 // DefaultTabWidth is the formatter's default visual tab width. DefaultTabWidth = 8 // DefaultCacheMaxEntries bounds retained persistent analysis results. DefaultCacheMaxEntries = 4096 // DefaultCacheMaxBytes bounds retained persistent analysis storage. DefaultCacheMaxBytes int64 = 512 << 20 )
const ( PresetCorrectness = rules.PresetCorrectness PresetSuspicious = rules.PresetSuspicious PresetPerformance = rules.PresetPerformance PresetComplexity = rules.PresetComplexity PresetStyle = rules.PresetStyle PresetPedantic = rules.PresetPedantic PresetNursery = rules.PresetNursery PresetRestriction = rules.PresetRestriction PresetMigration = rules.PresetMigration )
const ( SeverityOff = rules.SeverityOff SeverityWarn = rules.SeverityWarn SeverityError = rules.SeverityError )
const Version = 1
Version is the only accepted configuration schema version.
Variables ¶
This section is empty.
Functions ¶
func ValidProfile ¶
ValidProfile reports whether value names one built-in profile.
Types ¶
type Analysis ¶
type Analysis struct {
BuildTags []string
GOOS string
GOARCH string
CGOEnabled bool
Targets []AnalysisTarget
ContractFiles []string
Contracts contracts.Set
}
Analysis contains the resolved build selection for package-aware rules.
type AnalysisTarget ¶
AnalysisTarget is one explicit CI-oriented Go build selection.
func (AnalysisTarget) ID ¶
func (t AnalysisTarget) ID() string
ID returns the stable machine and human identity of one target.
type Config ¶
Config is one fully defaulted and validated project configuration.
func Defaults ¶
func Defaults() Config
Defaults returns an independent configuration containing built-in policy.
func Load ¶
func Load(selection Selection, options ParseOptions) (Config, error)
Load returns defaults or reads and parses one selected configuration.
func Parse ¶
func Parse(path string, input []byte, options ParseOptions) (Config, error)
Parse strictly decodes, defaults, and validates one configuration source.
func (Config) CanonicalBytes ¶
CanonicalBytes returns the deterministic identity of one fully resolved configuration. It excludes source spelling, comments, and cache lifecycle policy while retaining every value that can affect formatting or analysis.
func (Config) LintForExecution ¶
LintForExecution enables every rule that can be selected by a path override. Per-path filtering restores the exact severity after shared analysis runs.
type Error ¶
type Error struct {
Path string
Line int
Column int
Message string
// contains filtered or unexported fields
}
Error is one path-aware configuration diagnostic.
type Lint ¶
type Lint struct {
Profile Profile
ProfileRules map[string]Severity
Presets []Preset
WarningsAsErrors bool
Rules map[string]Severity
RuleOptions map[string]rules.OptionSet
Overrides []LintOverride
Suppressions Suppressions
Baseline Baseline
}
Lint contains the selected preset groups and explicit rule policy.
func (Lint) EffectiveRules ¶
EffectiveRules returns profile policy followed by explicit rule overrides.
type LintOverride ¶
LintOverride applies exact rule severities to matching project-relative paths. Overrides retain declaration order because later matches replace earlier ones.
type ParseOptions ¶
type ParseOptions struct {
KnownRules []string
RuleOptions map[string][]rules.OptionMetadata
}
ParseOptions supplies registry state needed to validate rule identifiers.
type Selection ¶
Selection identifies the project boundary and configuration for one input.
func DiscoverFileContext ¶
DiscoverFileContext selects configuration for an editor file path that may not exist yet.
type Suppressions ¶
Suppressions contains project policy for auditable lint waivers.