lint

package
v1.45.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package lint defines the shared finding model used by the stencil lint subcommands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Counts

func Counts(findings []Finding) (errors, warnings int)

Counts tallies the error and warning findings in a slice.

Types

type Finding

type Finding struct {
	// Severity is error or warning.
	Severity Severity
	// Path locates the problem. The manifest linter stores a dotted document
	// location (e.g. "arguments.foo.schema"); the templates linter stores the
	// template file path. In both cases Line, when non-zero, is the 1-based
	// source line.
	Path string
	// Message is a human-readable description of the problem.
	Message string
	// Line is the 1-based source line of the YAML key this finding references,
	// or 0 when no line is known (whole-document findings, or an unresolved path).
	Line int
}

Finding is a single problem discovered while linting.

type Findings

type Findings struct {
	// contains filtered or unexported fields
}

Findings accumulates Finding values during a lint run. The zero value is ready to use.

func (*Findings) Add

func (f *Findings) Add(find Finding)

Add appends a pre-built Finding.

func (*Findings) Counts

func (f *Findings) Counts() (errors, warnings int)

Counts returns the number of error and warning findings.

func (*Findings) Errorf

func (f *Findings) Errorf(path, format string, a ...any)

Errorf appends a SeverityError finding at path with a formatted message.

func (*Findings) Infof

func (f *Findings) Infof(path, format string, a ...any)

Infof appends a SeverityInfo finding at path with a formatted message.

func (*Findings) Items

func (f *Findings) Items() []Finding

Items returns the accumulated findings in insertion order.

func (*Findings) Warnf

func (f *Findings) Warnf(path, format string, a ...any)

Warnf appends a SeverityWarning finding at path with a formatted message.

type Severity

type Severity string

Severity is the severity of a lint Finding.

const (
	// SeverityError marks a finding that is always a failure.
	SeverityError Severity = "error"
	// SeverityWarning marks a finding that fails only when warnings are
	// treated as errors.
	SeverityWarning Severity = "warning"
	// SeverityInfo marks an informational finding that never fails a lint run.
	SeverityInfo Severity = "info"
)

Severity values.

Directories

Path Synopsis
Package manifest implements static validation of a Stencil template repository manifest (manifest.yaml) without resolving dependencies or accessing the network.
Package manifest implements static validation of a Stencil template repository manifest (manifest.yaml) without resolving dependencies or accessing the network.
Package modulefix implements the shared module-deprecation auto-fix used by both the manifest and project-manifest linters.
Package modulefix implements the shared module-deprecation auto-fix used by both the manifest and project-manifest linters.
Package projectmanifest implements static offline validation of a Stencil project manifest (service.yaml).
Package projectmanifest implements static offline validation of a Stencil project manifest (service.yaml).
Package templates implements static block-correctness validation of Stencil template files without rendering or resolving dependencies.
Package templates implements static block-correctness validation of Stencil template files without rendering or resolving dependencies.
Package yamlfix provides generic yaml.Node DOM primitives shared by the Stencil manifest lint fixers and line resolvers.
Package yamlfix provides generic yaml.Node DOM primitives shared by the Stencil manifest lint fixers and line resolvers.

Jump to

Keyboard shortcuts

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