config

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package config loads repository-owned Lagotto configuration.

Index

Constants

View Source
const Filename = ".lagotto.yaml"

Filename is the repository-root configuration filename Lagotto discovers.

Variables

This section is empty.

Functions

func Validate

func Validate(cfg Config) error

Validate rejects unsupported versions, invalid suppressions, thresholds, and severity names before package loading begins.

Types

type Config

type Config struct {
	Version     int                     `yaml:"version"`
	Suppress    []string                `yaml:"suppress"`
	Mixed       MixedConfig             `yaml:"mixed"`
	LayerPolicy []LayerPolicyRuleConfig `yaml:"layer_policy"`
}

Config is the versioned repository policy loaded from .lagotto.yaml.

func Load

func Load(root, explicit string) (Config, string, error)

Load reads an explicit config path, or root/.lagotto.yaml when explicit is empty. A missing auto-discovered file is not an error. Unknown YAML fields are rejected so misspelled policy does not silently stop applying.

type LayerPolicyRuleConfig

type LayerPolicyRuleConfig struct {
	Name                       string   `yaml:"name"`
	Paths                      []string `yaml:"paths"`
	Dependencies               []string `yaml:"dependencies"`
	GeneratedTypes             []string `yaml:"generated_types"`
	MaxCoordinatedDependencies *int     `yaml:"max_coordinated_dependencies"`
	Severity                   string   `yaml:"severity"`
}

LayerPolicyRuleConfig describes one repository-owned G14 boundary policy. Package patterns may be full import paths or module-relative globs.

type MixedConfig

type MixedConfig struct {
	MinLines                     *int   `yaml:"min_lines"`
	MinComponentMembers          *int   `yaml:"min_component_members"`
	MinComponentLines            *int   `yaml:"min_component_lines"`
	MinSingleComponentComplexity *int   `yaml:"min_single_component_complexity"`
	Severity                     string `yaml:"severity"`
	CohesiveMinLines             *int   `yaml:"cohesive_min_lines"`
}

MixedConfig contains optional G5 threshold and severity overrides.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL