analyzers

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 NewNormalizer

func NewNormalizer() *Normalizer

NewNormalizer creates a new Normalizer.

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL