baseline

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: 0BSD Imports: 14 Imported by: 0

Documentation

Overview

Package baseline owns deterministic, source-bound lint adoption waivers.

Index

Constants

View Source
const SchemaVersion = 1

SchemaVersion is the only accepted baseline document version.

Variables

This section is empty.

Functions

func Encode

func Encode(document Document) ([]byte, error)

Encode returns the canonical indented representation with one final newline.

func ValidPath

func ValidPath(value string) bool

ValidPath reports whether a baseline entry or configured document path is portable.

Types

type AppliedFile

type AppliedFile struct {
	Path        string
	Diagnostics []rules.Diagnostic
	Baselined   []rules.Diagnostic
}

AppliedFile separates visible diagnostics from baseline-owned diagnostics.

type ApplyOptions

type ApplyOptions struct {
	ReportStale  bool
	ExpiryCutoff string
	Incomplete   bool
}

ApplyOptions controls explicit stale and expiry policy.

type ApplyResult

type ApplyResult struct {
	Files    []AppliedFile
	Problems []Problem
}

ApplyResult is one complete baseline application over exact input files.

func Apply

func Apply(
	root string,
	document Document,
	inputs []InputFile,
	options ApplyOptions,
) (ApplyResult, error)

Apply consumes exact baseline counts without hiding changed diagnostics.

type Document

type Document struct {
	SchemaVersion int     `json:"schema_version"`
	Entries       []Entry `json:"entries"`
}

Document is one portable, deterministic lint baseline.

func Generate

func Generate(root string, inputs []InputFile) (Document, error)

Generate creates one portable document from visible source diagnostics.

func Parse

func Parse(name string, input []byte, options ParseOptions) (Document, error)

Parse strictly decodes and validates one baseline document.

type Entry

type Entry struct {
	RuleID            string `json:"rule_id"`
	Path              string `json:"path"`
	MessageKey        string `json:"message_key"`
	SourceFingerprint string `json:"source_fingerprint"`
	Count             int    `json:"count"`
	Reason            string `json:"reason,omitempty"`
	ExpiresOn         string `json:"expires_on,omitempty"`
}

Entry suppresses an exact number of structurally identical diagnostics.

type InputFile

type InputFile struct {
	File        *source.File
	Diagnostics []rules.Diagnostic
}

InputFile binds diagnostics to the exact immutable source used to produce them.

type ParseOptions

type ParseOptions struct {
	KnownRules []string
}

ParseOptions supplies registry identity for strict baseline validation.

type Problem

type Problem struct {
	Kind      ProblemKind
	Entry     Entry
	Remaining int
}

Problem is one deterministic baseline policy finding.

type ProblemKind

type ProblemKind string

ProblemKind classifies an adoption waiver that no longer applies.

const (
	// ProblemStale identifies an unused baseline count.
	ProblemStale ProblemKind = "stale"
	// ProblemExpired identifies an entry disabled by the configured cutoff.
	ProblemExpired ProblemKind = "expired"
)

Jump to

Keyboard shortcuts

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