Documentation
¶
Overview ¶
Package suppressions parses and owns physical lint-suppression ranges.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse(file *source.File, options ParseOptions) (Index, []Problem)
Parse validates Glippy suppression directives and assigns physical targets.
func ValidateStable ¶
func ValidateStable(before, after physicalSource) error
ValidateStable verifies that every structurally valid suppression continues to own the same normalized physical tokens after a source transformation. Rule registration and configurable reason or expiry policy deliberately do not participate because formatting must be stable without lint configuration.
Types ¶
type Application ¶
type Application struct {
Diagnostics []rules.Diagnostic
Suppressed []SuppressedDiagnostic
Unused []Directive
}
Application is one deterministic suppression pass over ordered diagnostics.
type Directive ¶
type Directive struct {
Scope Scope
RuleID string
Range source.Range
Target source.Range
Reason string
ExpiresOn string
}
Directive is one validated exact-rule suppression.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index is an immutable source-ordered suppression set.
func (Index) Apply ¶
func (i Index) Apply(diagnostics []rules.Diagnostic) Application
Apply removes matched diagnostics and reports used and unused directives.
func (Index) Directives ¶
Directives returns an independent source-ordered suppression snapshot.
type ParseOptions ¶
ParseOptions supplies registry, reason, and deterministic expiry policy.
type Problem ¶
type Problem struct {
Kind ProblemKind
Range source.Range
Message string
}
Problem is one source-ordered suppression diagnostic.
type ProblemKind ¶
type ProblemKind string
ProblemKind classifies one suppression or parser-configuration defect.
const ( ProblemMalformed ProblemKind = "malformed" ProblemUnknownRule ProblemKind = "unknown-rule" ProblemMissingReason ProblemKind = "missing-reason" ProblemInvalidExpiry ProblemKind = "invalid-expiry" ProblemExpired ProblemKind = "expired" ProblemMisplacedFileScope ProblemKind = "misplaced-file-scope" ProblemUnmatchedRangeEnd ProblemKind = "unmatched-range-end" ProblemNestedRange ProblemKind = "nested-range" ProblemUnclosedRange ProblemKind = "unclosed-range" ProblemInvalidConfiguration ProblemKind = "invalid-configuration" ProblemLegacyDirective ProblemKind = "legacy-directive" )
type SuppressedDiagnostic ¶
type SuppressedDiagnostic struct {
Diagnostic rules.Diagnostic
Directive Directive
}
SuppressedDiagnostic binds one removed diagnostic to its owning directive.