Documentation
¶
Index ¶
- func CreateFlagSet() *flag.FlagSet
- type Config
- func (c *Config) FilterFiles(pass *analysis.Pass) iter.Seq[*ast.File]
- func (c *Config) ShouldSkipFile(pass *analysis.Pass, file *ast.File) bool
- func (c *Config) WithExcludeChecks(excludeChecks []string) *Config
- func (c *Config) WithExcludePaths(excludePaths []string) *Config
- func (c *Config) WithScanTests(scanTests bool) *Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFlagSet ¶
CreateFlagSet creates and returns a flagset with gogreement-specific flags. This allows the flags to be registered in the analyzer and appear in help. IMPORTANT: Flag names are automatically prefixed with "config" by multichecker framework when used in the config analyzer. Do not modify flag names as it affects CLI.
Types ¶
type Config ¶
type Config struct {
// ScanTests determines whether test files should be analyzed
// By default, test files (*_test.go) are excluded from analysis
// Environment variable: GOGREEMENT_SCAN_TESTS=true|false
// Command line flag: --scan-tests=true|false
ScanTests bool
// ExcludePaths is a list of path patterns to exclude from analysis
// Paths are matched as substrings (e.g. "testdata" will exclude any path containing "testdata")
// Environment variable: GOGREEMENT_EXCLUDE_PATHS=path1,path2,path3
// Command line flag: --exclude-paths=path1,path2,path3
// Default: ["testdata"]
ExcludePaths []string
// ExcludeChecks is a list of check codes to exclude from analysis
// Can be individual codes (IMM01) or categories (IMM) or ALL
// Environment variable: GOGREEMENT_EXCLUDE_CHECKS=IMM01,CTOR,TONL
// Command line flag: --exclude-checks=IMM01,CTOR,TONL
// Default: [] (no exclusions)
ExcludeChecks []string
}
Config holds the configuration for gogreement analyzers @immutable @constructor New
func ParseFlagsFromFlagSet ¶
ParseFlagsFromFlagSet parses configuration from a FlagSet and environment variables. Command line flags from the FlagSet take priority over environment variables. If GOGREEMENT_ENV_ONLY is set, will use only environment variables (for testing).
func (*Config) FilterFiles ¶
FilterFiles returns only the files that should be analyzed based on configuration
func (*Config) ShouldSkipFile ¶
ShouldSkipFile returns true if the file should be skipped based on configuration
func (*Config) WithExcludeChecks ¶
WithExcludeChecks returns a new Config with ExcludeChecks set to the specified value
func (*Config) WithExcludePaths ¶
WithExcludePaths returns a new Config with ExcludePaths set to the specified value
func (*Config) WithScanTests ¶
WithScanTests returns a new Config with ScanTests set to the specified value