Documentation
¶
Overview ¶
Package analyzers provides semantic analysis utilities for diff comparisons.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Normalizer ¶
type Normalizer struct{}
Normalizer normalizes configuration values to reduce false-positive diffs. It returns normalized copies and never mutates the originals.
func (*Normalizer) NormalizeIP ¶
func (n *Normalizer) NormalizeIP(s string) string
NormalizeIP normalizes an IP address string by stripping leading zeros from each octet. For example, "192.168.001.001" becomes "192.168.1.1". CIDR notation is also supported: "010.000.000.000/8" becomes "10.0.0.0/8". Returns the original string unchanged if it's not a valid IPv4/IPv6 address.
func (*Normalizer) NormalizePath ¶
func (n *Normalizer) NormalizePath(s string) string
NormalizePath normalizes a file or configuration path by removing trailing slashes and collapsing consecutive slashes.
func (*Normalizer) NormalizePort ¶
func (n *Normalizer) NormalizePort(s string) string
NormalizePort normalizes a port or port range string. "80" stays "80", "0080" becomes "80", "80-443" stays "80-443". Returns the input unchanged if it does not look like a port or port range (i.e., contains non-digit characters other than a single separator).
func (*Normalizer) NormalizeProtocol ¶
func (n *Normalizer) NormalizeProtocol(s string) string
NormalizeProtocol normalizes a protocol name to lowercase.
func (*Normalizer) NormalizeWhitespace ¶
func (n *Normalizer) NormalizeWhitespace(s string) string
NormalizeWhitespace collapses consecutive whitespace into single spaces and trims leading/trailing whitespace.
type OrderChange ¶
type OrderChange struct {
ID string // UUID or identifier of the reordered element
OldPosition int // 0-based index in old config
NewPosition int // 0-based index in new config
}
OrderChange describes a detected reordering.
type OrderDetector ¶
type OrderDetector struct{}
OrderDetector detects when elements are reordered without content changes.
func NewOrderDetector ¶
func NewOrderDetector() *OrderDetector
NewOrderDetector creates a new OrderDetector.
func (*OrderDetector) DetectReorders ¶
func (d *OrderDetector) DetectReorders(oldIDs, newIDs []string) []OrderChange
DetectReorders compares two ordered lists of identifiers and returns elements that changed position. Elements present in only one list are ignored (those are additions/removals, not reorders).
func (*OrderDetector) HasReorders ¶
func (d *OrderDetector) HasReorders(oldIDs, newIDs []string) bool
HasReorders returns true if any reordering was detected.