config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package config handles .stringer.yaml configuration files.

Index

Constants

View Source
const FileName = ".stringer.yaml"

FileName is the expected config file name in a repository root.

Variables

This section is empty.

Functions

func Merge

func Merge(fileCfg *Config, cliCfg signal.ScanConfig) signal.ScanConfig

Merge combines file-based config with CLI-provided ScanConfig. CLI values take precedence; zero-value CLI fields fall through to file config.

func Validate

func Validate(cfg *Config) error

Validate checks all fields in the config and returns all errors at once.

func Write

func Write(w io.Writer, cfg *Config) error

Write marshals the config to YAML and writes it to w.

Types

type CollectorConfig

type CollectorConfig struct {
	Enabled         *bool    `yaml:"enabled,omitempty"`
	ErrorMode       string   `yaml:"error_mode,omitempty"`
	MinConfidence   float64  `yaml:"min_confidence,omitempty"`
	IncludePatterns []string `yaml:"include_patterns,omitempty"`
	ExcludePatterns []string `yaml:"exclude_patterns,omitempty"`

	// Lottery risk collector settings.
	LotteryRiskThreshold int `yaml:"lottery_risk_threshold,omitempty"`
	DirectoryDepth       int `yaml:"directory_depth,omitempty"`
	MaxBlameFiles        int `yaml:"max_blame_files,omitempty"`

	// GitHub collector settings.
	IncludePRs            *bool `yaml:"include_prs,omitempty"`
	CommentDepth          int   `yaml:"comment_depth,omitempty"`
	MaxIssuesPerCollector int   `yaml:"max_issues_per_collector,omitempty"`
}

CollectorConfig holds per-collector settings in the config file.

type Config

type Config struct {
	OutputFormat string                     `yaml:"output_format,omitempty"`
	MaxIssues    int                        `yaml:"max_issues,omitempty"`
	NoLLM        bool                       `yaml:"no_llm,omitempty"`
	Collectors   map[string]CollectorConfig `yaml:"collectors,omitempty"`
}

Config represents the contents of a .stringer.yaml file.

func Load

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

Load reads the .stringer.yaml file from the given repository root. If the file does not exist, it returns a zero-value Config and nil error.

Jump to

Keyboard shortcuts

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