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 returns the canonical form of an IP address or CIDR: IPv6 is shortened ("2001:0db8::1" becomes "2001:db8::1") and a CIDR prefix length loses leading zeros ("/024" becomes "/24"). Anything the standard library rejects is returned unchanged. That includes an IPv4 address with a zero-padded octet such as "172.016.000.001": inet_aton-family parsers read a leading zero as octal and the validator rejects the form, so it is never treated as formatting.
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).