Documentation
¶
Index ¶
- Variables
- func FindBestMatch(target string, candidates []string, threshold float64) (string, float64, bool)
- func FindRemovedValues(oldPattern, newPattern *ContainsPattern) []string
- func GetSimilarityThreshold() float64
- func IsRenameDetectionEnabled() bool
- func LevenshteinDistance(a, b string) int
- func Register(rule Rule)
- func SetRenameDetectionSettings(settings *RenameDetectionSettings)
- func Similarity(a, b string) float64
- type BC001
- type BC002
- type BC003
- type BC004
- type BC005
- type BC009
- type BC010
- type BC100
- type BC101
- type BC102
- type BC103
- type BC200
- type BC201
- type CheckOptions
- type ContainsPattern
- type Documentable
- type Engine
- func (e *Engine) Check(oldPath, newPath string, old, new *types.ModuleSnapshot, failOn types.Severity) *types.CheckResult
- func (e *Engine) CheckWithOptions(oldPath, newPath string, old, new *types.ModuleSnapshot, failOn types.Severity, ...) *types.CheckResult
- func (e *Engine) DisableAllRules()
- func (e *Engine) DisableRule(ruleID string)
- func (e *Engine) EnableRule(ruleID string)
- func (e *Engine) Evaluate(old, new *types.ModuleSnapshot) []*types.Finding
- func (e *Engine) GetConfig(ruleID string) *RuleConfig
- func (e *Engine) SetConfig(ruleID string, config *RuleConfig)
- type RC003
- type RC006
- type RC007
- type RC008
- type RC011
- type RC012
- type RC013
- type RC300
- type RC301
- type Registry
- type RenameDetectionSettings
- type Rule
- type RuleConfig
- type RuleDoc
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = NewRegistry()
DefaultRegistry is the global rule registry
Functions ¶
func FindBestMatch ¶
FindBestMatch finds the string in candidates that has the highest similarity to target. Returns the best matching string, its similarity score, and whether a match was found above the given threshold.
func FindRemovedValues ¶
func FindRemovedValues(oldPattern, newPattern *ContainsPattern) []string
FindRemovedValues compares old and new contains patterns and returns removed values. A value is "removed" if it was in the old list but not in the new list.
func GetSimilarityThreshold ¶
func GetSimilarityThreshold() float64
GetSimilarityThreshold returns the current similarity threshold
func IsRenameDetectionEnabled ¶
func IsRenameDetectionEnabled() bool
IsRenameDetectionEnabled returns whether rename detection is enabled
func LevenshteinDistance ¶
LevenshteinDistance calculates the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into another.
func SetRenameDetectionSettings ¶
func SetRenameDetectionSettings(settings *RenameDetectionSettings)
SetRenameDetectionSettings updates the rename detection configuration
func Similarity ¶
Similarity calculates a normalized similarity score between two strings. Returns a value between 0.0 (completely different) and 1.0 (identical). The formula is: 1 - (levenshtein_distance / max(len(a), len(b)))
Types ¶
type BC001 ¶
type BC001 struct{}
BC001 detects when a new required variable is added
func (*BC001) DefaultSeverity ¶
func (*BC001) Description ¶
func (*BC001) Documentation ¶
type BC002 ¶
type BC002 struct{}
BC002 detects when an existing variable is removed
func (*BC002) DefaultSeverity ¶
func (*BC002) Description ¶
func (*BC002) Documentation ¶
type BC003 ¶
type BC003 struct{}
BC003 detects when a required variable is renamed (removed + similar required variable added)
func (*BC003) DefaultSeverity ¶
func (*BC003) Description ¶
func (*BC003) Documentation ¶
type BC004 ¶
type BC004 struct{}
BC004 detects when a variable's type constraint changes
func (*BC004) DefaultSeverity ¶
func (*BC004) Description ¶
func (*BC004) Documentation ¶
type BC005 ¶
type BC005 struct{}
BC005 detects when a variable's default value is removed
func (*BC005) DefaultSeverity ¶
func (*BC005) Description ¶
func (*BC005) Documentation ¶
type BC009 ¶
type BC009 struct{}
BC009 detects when an output is removed
func (*BC009) DefaultSeverity ¶
func (*BC009) Description ¶
func (*BC009) Documentation ¶
type BC010 ¶
type BC010 struct{}
BC010 detects when an output is renamed (removed + similar output added)
func (*BC010) DefaultSeverity ¶
func (*BC010) Description ¶
func (*BC010) Documentation ¶
type BC100 ¶
type BC100 struct{}
BC100 detects when a resource is removed without a corresponding moved block
func (*BC100) DefaultSeverity ¶
func (*BC100) Description ¶
func (*BC100) Documentation ¶
type BC101 ¶
type BC101 struct{}
BC101 detects when a module is removed without a corresponding moved block
func (*BC101) DefaultSeverity ¶
func (*BC101) Description ¶
func (*BC101) Documentation ¶
type BC102 ¶
type BC102 struct{}
BC102 detects invalid moved blocks
func (*BC102) DefaultSeverity ¶
func (*BC102) Description ¶
func (*BC102) Documentation ¶
type BC103 ¶
type BC103 struct{}
BC103 detects conflicting moved blocks
func (*BC103) DefaultSeverity ¶
func (*BC103) Description ¶
func (*BC103) Documentation ¶
type BC200 ¶
type BC200 struct{}
BC200 detects when terraform required_version constraint is added or changed
func (*BC200) DefaultSeverity ¶
func (*BC200) Description ¶
func (*BC200) Documentation ¶
type BC201 ¶
type BC201 struct{}
BC201 detects when provider requirements are removed or changed
func (*BC201) DefaultSeverity ¶
func (*BC201) Description ¶
func (*BC201) Documentation ¶
type CheckOptions ¶
type CheckOptions struct {
// IncludeRemediation populates remediation text for each finding
IncludeRemediation bool
}
CheckOptions configures the behavior of the Check method
type ContainsPattern ¶
type ContainsPattern struct {
Values []string // The literal string values in the list
VarName string // The variable name being checked
RawExpr string // The original expression
}
ContainsPattern represents a parsed contains([list], var.name) pattern
func ParseContainsPattern ¶
func ParseContainsPattern(condition string) *ContainsPattern
ParseContainsPattern attempts to parse a contains([list], var.name) pattern from a validation condition expression. Returns nil if the expression doesn't match the pattern or uses dynamic lists.
type Documentable ¶
type Documentable interface {
Documentation() *RuleDoc
}
Documentable is implemented by rules that provide documentation
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine evaluates rules against module snapshots
func NewDefaultEngine ¶
func NewDefaultEngine() *Engine
NewDefaultEngine creates an Engine with the default registry and default configs
func (*Engine) Check ¶
func (e *Engine) Check(oldPath, newPath string, old, new *types.ModuleSnapshot, failOn types.Severity) *types.CheckResult
Check runs the engine and returns a complete CheckResult
func (*Engine) CheckWithOptions ¶
func (e *Engine) CheckWithOptions(oldPath, newPath string, old, new *types.ModuleSnapshot, failOn types.Severity, opts CheckOptions) *types.CheckResult
CheckWithOptions runs the engine with additional options
func (*Engine) DisableAllRules ¶ added in v0.5.0
func (e *Engine) DisableAllRules()
DisableAllRules disables all rules in the engine
func (*Engine) DisableRule ¶
DisableRule disables a rule
func (*Engine) Evaluate ¶
func (e *Engine) Evaluate(old, new *types.ModuleSnapshot) []*types.Finding
Evaluate runs all enabled rules against the old and new snapshots
func (*Engine) GetConfig ¶
func (e *Engine) GetConfig(ruleID string) *RuleConfig
GetConfig returns the configuration for a specific rule
func (*Engine) SetConfig ¶
func (e *Engine) SetConfig(ruleID string, config *RuleConfig)
SetConfig sets the configuration for a specific rule
type RC003 ¶
type RC003 struct{}
RC003 detects when an optional variable is renamed (removed + similar optional variable added)
func (*RC003) DefaultSeverity ¶
func (*RC003) Description ¶
func (*RC003) Documentation ¶
type RC006 ¶
type RC006 struct{}
RC006 detects when a variable's default value changes
func (*RC006) DefaultSeverity ¶
func (*RC006) Description ¶
func (*RC006) Documentation ¶
type RC007 ¶
type RC007 struct{}
RC007 detects when a variable's nullable attribute changes
func (*RC007) DefaultSeverity ¶
func (*RC007) Description ¶
func (*RC007) Documentation ¶
type RC008 ¶
type RC008 struct{}
RC008 detects when a variable's sensitive attribute changes
func (*RC008) DefaultSeverity ¶
func (*RC008) Description ¶
func (*RC008) Documentation ¶
type RC011 ¶
type RC011 struct{}
RC011 detects when an output's sensitive attribute changes
func (*RC011) DefaultSeverity ¶
func (*RC011) Description ¶
func (*RC011) Documentation ¶
type RC012 ¶
type RC012 struct{}
RC012 detects when validation blocks are added to a variable
func (*RC012) DefaultSeverity ¶
DefaultSeverity returns the default severity level for this rule.
func (*RC012) Description ¶
Description returns a description of what this rule detects.
func (*RC012) Documentation ¶
Documentation returns the documentation for this rule.
type RC013 ¶
type RC013 struct{}
RC013 detects when allowed values are removed from a contains() validation pattern
func (*RC013) DefaultSeverity ¶
DefaultSeverity returns the default severity level for this rule.
func (*RC013) Description ¶
Description returns a description of what this rule detects.
func (*RC013) Documentation ¶
Documentation returns the documentation for this rule.
type RC300 ¶
type RC300 struct{}
RC300 detects when a module call's source URL changes
func (*RC300) DefaultSeverity ¶
DefaultSeverity returns the default severity level for this rule.
func (*RC300) Description ¶
Description returns a description of what this rule detects.
func (*RC300) Documentation ¶
Documentation returns the documentation for this rule.
type RC301 ¶
type RC301 struct{}
RC301 detects when a module call's version constraint changes
func (*RC301) DefaultSeverity ¶
DefaultSeverity returns the default severity level for this rule.
func (*RC301) Description ¶
Description returns a description of what this rule detects.
func (*RC301) Documentation ¶
Documentation returns the documentation for this rule.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all registered rules
func (*Registry) NameToIDMap ¶
NameToIDMap returns a map from rule names to rule IDs
type RenameDetectionSettings ¶
RenameDetectionSettings holds the configuration for rename detection rules
func DefaultRenameDetectionSettings ¶
func DefaultRenameDetectionSettings() *RenameDetectionSettings
DefaultRenameDetectionSettings returns the default settings (disabled)
func GetRenameDetectionSettings ¶
func GetRenameDetectionSettings() *RenameDetectionSettings
GetRenameDetectionSettings returns the current rename detection configuration
type Rule ¶
type Rule interface {
// ID returns the unique identifier for this rule (e.g., "BC001")
ID() string
// Name returns the human-readable name (e.g., "required-input-added")
Name() string
// Description returns a description of what this rule detects
Description() string
// DefaultSeverity returns the default severity level for this rule
DefaultSeverity() types.Severity
// Evaluate checks the old and new snapshots and returns any findings
Evaluate(old, new *types.ModuleSnapshot) []*types.Finding
}
Rule defines the interface for a breaking change detection rule
type RuleConfig ¶
RuleConfig holds configuration for a single rule
func DefaultRuleConfig ¶
func DefaultRuleConfig(r Rule) *RuleConfig
DefaultRuleConfig returns the default configuration for a rule