Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeCollector ¶
NodeCollector defines the interface for types that can collect and process AST nodes from a source file.
type NodeFilter ¶
NodeFilter defines the interface for types that can determine if an AST node should be excluded from mutation.
type SkipMakeArgsFilter ¶
type SkipMakeArgsFilter struct {
// IgnoredNodes maps positions of numeric literals to their parent 'make' call expressions
IgnoredNodes map[token.Pos]*ast.CallExpr
}
SkipMakeArgsFilter is a filter that tracks numeric arguments in 'make' calls for slices and maps to be ignored during mutation.
func NewSkipMakeArgsFilter ¶
func NewSkipMakeArgsFilter() *SkipMakeArgsFilter
NewSkipMakeArgsFilter creates and returns a new initialized Processor.
func (*SkipMakeArgsFilter) Collect ¶
Collect collects numeric arguments (children) from 'make' calls (parents) for slices/maps to be ignored during mutation
func (*SkipMakeArgsFilter) ShouldSkip ¶
func (s *SkipMakeArgsFilter) ShouldSkip(node ast.Node, _ string) bool
ShouldSkip determines whether a given AST node should be skipped during mutation.
type SourceLineRegexFilter ¶ added in v2.6.7
type SourceLineRegexFilter struct {
// contains filtered or unexported fields
}
SourceLineRegexFilter skips mutations on any source line that matches one of the configured regular expressions. This lets teams suppress known-noisy patterns globally in the config file without modifying source files.
Example config usage:
ignore_source_lines: - "assert\\." # skip lines that call assertion helpers - "//\\s*nolint" # skip lines with nolint directives
func NewSourceLineRegexFilter ¶ added in v2.6.7
func NewSourceLineRegexFilter(patterns []string) *SourceLineRegexFilter
NewSourceLineRegexFilter compiles each pattern string and returns a filter. Patterns that fail to compile are silently skipped.
func (*SourceLineRegexFilter) Collect ¶ added in v2.6.7
Collect reads the source file and records the positions of all AST nodes that sit on lines matching any configured pattern.
func (*SourceLineRegexFilter) ShouldSkip ¶ added in v2.6.7
func (f *SourceLineRegexFilter) ShouldSkip(node ast.Node, _ string) bool
ShouldSkip implements NodeFilter. Returns true when the node's start position falls on a line that matched a configured regex.