config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisConfig

type AnalysisConfig struct {
	Complexity  bool `koanf:"complexity"`
	SATD        bool `koanf:"satd"`
	DeadCode    bool `koanf:"dead_code"`
	Churn       bool `koanf:"churn"`
	Duplicates  bool `koanf:"duplicates"`
	Defect      bool `koanf:"defect"`
	TDG         bool `koanf:"tdg"`
	Graph       bool `koanf:"graph"`
	LintHotspot bool `koanf:"lint_hotspot"`
	Context     bool `koanf:"context"`
	ChurnDays   int  `koanf:"churn_days"`
}

AnalysisConfig controls which analyzers run.

type CacheConfig

type CacheConfig struct {
	Enabled bool   `koanf:"enabled"`
	Dir     string `koanf:"dir"`
	TTL     int    `koanf:"ttl"` // TTL in hours
}

CacheConfig controls caching behavior.

type Config

type Config struct {
	// Analysis settings
	Analysis AnalysisConfig `koanf:"analysis"`

	// Thresholds for various metrics
	Thresholds ThresholdConfig `koanf:"thresholds"`

	// File exclusion patterns
	Exclude ExcludeConfig `koanf:"exclude"`

	// Cache settings
	Cache CacheConfig `koanf:"cache"`

	// Output settings
	Output OutputConfig `koanf:"output"`
}

Config holds all configuration options for omen.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a config with sensible defaults.

func Load

func Load(path string) (*Config, error)

Load loads configuration from a file.

func LoadOrDefault

func LoadOrDefault() *Config

LoadOrDefault tries to load config from standard locations or returns defaults.

func (*Config) ShouldExclude

func (c *Config) ShouldExclude(path string) bool

ShouldExclude checks if a path should be excluded from analysis.

type ExcludeConfig

type ExcludeConfig struct {
	Patterns   []string `koanf:"patterns"`
	Extensions []string `koanf:"extensions"`
	Dirs       []string `koanf:"dirs"`
	Gitignore  bool     `koanf:"gitignore"`
}

ExcludeConfig defines file exclusion patterns.

type OutputConfig

type OutputConfig struct {
	Format  string `koanf:"format"` // text, json, markdown
	Color   bool   `koanf:"color"`
	Verbose bool   `koanf:"verbose"`
}

OutputConfig controls output formatting.

type ThresholdConfig

type ThresholdConfig struct {
	CyclomaticComplexity int     `koanf:"cyclomatic_complexity"`
	CognitiveComplexity  int     `koanf:"cognitive_complexity"`
	DuplicateMinLines    int     `koanf:"duplicate_min_lines"`
	DuplicateSimilarity  float64 `koanf:"duplicate_similarity"`
	DeadCodeConfidence   float64 `koanf:"dead_code_confidence"`
	DefectHighRisk       float64 `koanf:"defect_high_risk"`
	TDGHighRisk          float64 `koanf:"tdg_high_risk"`
}

ThresholdConfig defines metric thresholds.

Jump to

Keyboard shortcuts

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