config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Thresholds ThresholdConfig            `toml:"thresholds"`
	Scan       ScanConfig                 `toml:"scan"`
	Context    ContextConfig              `toml:"context"`
	PerPath    map[string]ThresholdConfig `toml:"per-path"`
}

Config holds all adit configuration.

func Default

func Default() Config

Default returns a Config with sensible defaults.

func Load

func Load(startDir string) (Config, error)

Load finds and loads configuration, walking up from startDir. Checks adit.toml first, then pyproject.toml [tool.adit]. Falls back to defaults for any missing values.

func LoadFile

func LoadFile(path string) (Config, error)

LoadFile loads configuration from a specific file path.

func (Config) ThresholdsForPath

func (c Config) ThresholdsForPath(filePath string) ThresholdConfig

ThresholdsForPath returns the thresholds that apply to a given file path. If a per-path override matches, its non-zero values override the base thresholds. Patterns are checked in sorted order for deterministic behavior.

type ContextConfig

type ContextConfig struct {
	WindowTokens   int     `toml:"window_tokens"`
	UsableFraction float64 `toml:"usable_fraction"`
}

ContextConfig holds informational context window settings.

type ScanConfig

type ScanConfig struct {
	Exclude []string `toml:"exclude"`
}

ScanConfig controls what to scan.

type ThresholdConfig

type ThresholdConfig struct {
	MaxFileLines        int `toml:"max_file_lines"`
	MaxContextReads     int `toml:"max_context_reads"`
	MaxUnnecessaryReads int `toml:"max_unnecessary_reads"`
	MaxAmbiguityDefs    int `toml:"max_ambiguity_defs"`
	MaxBlastRadius      int `toml:"max_blast_radius"`
	MaxCycleLength      int `toml:"max_cycle_length"`
	MaxNestingDepth     int `toml:"max_nesting_depth"` // 0 = not enforced
	MaxParams           int `toml:"max_params"`        // 0 = not enforced
}

ThresholdConfig holds enforcement thresholds. Zero values mean "not enforced" (except MaxCycleLength where 0 = no cycles allowed).

Jump to

Keyboard shortcuts

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