lint

package
v0.33.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

AllScopes lists every scope, for linters that apply to all of them.

AllTypes lists every package type, for linters that apply to all of them.

Functions

This section is empty.

Types

type Level

type Level int

Level represents the severity of a lint diagnostic.

const (
	Ignored Level = iota // diagnostic is suppressed
	Warn                 // non-blocking advisory
	Error                // blocking issue
	Pass                 // rule ran and reported nothing
)

Severity levels ordered from least to most severe, followed by Pass. Pass sits outside the severity order: it marks a rule that found nothing rather than a diagnostic, which is why it is never capped by a configured impact.

func (Level) Ptr

func (l Level) Ptr() *Level

Ptr returns pointer of the level

func (Level) String

func (l Level) String() string

String returns the canonical string representation of the Level.

type LinterSettings

type LinterSettings struct {
	Impact *Level
}

LinterSettings holds the configured severity for an entire linter.

func (*LinterSettings) SetLevel

func (s *LinterSettings) SetLevel(level string)

SetLevel parses level and stores it as the linter's impact severity, defaulting to Error when level is empty.

type PackageType added in v0.33.5

type PackageType string

PackageType names a kind of package. It mirrors the type recorded in package.yaml without importing the package loader, which sits above this package in the layering. Conversion happens once, where the definition is read.

const (
	// TypeApplication is a package deploying per-instance resources.
	TypeApplication PackageType = "Application"
	// TypeModule is a package deploying a cluster module, with hooks and CRDs.
	TypeModule PackageType = "Module"
)

type RuleScopes added in v0.33.5

type RuleScopes map[string]TypeScopes

RuleScopes narrows individual rules to fewer targets than their linter runs in, keyed by rule ID. A rule absent from the map inherits its linter's targets, so only the exceptions need listing.

func (RuleScopes) Runs added in v0.33.5

func (r RuleScopes) Runs(ruleID string, linterScopes TypeScopes, target Target) bool

Runs reports whether the rule is processed for target, falling back to the linter's own targets when the rule declares none of its own.

type RuleSettings

type RuleSettings struct {
	Impact *Level
}

RuleSettings holds the configured severity for an individual rule.

func (*RuleSettings) SetLevel

func (s *RuleSettings) SetLevel(level string, fallback *Level)

SetLevel parses level or, if empty, fallback and stores the result as the rule's impact severity, defaulting to Error when both are empty.

type Scope added in v0.33.5

type Scope string

Scope names one verification target. The three sources a package is verified from carry different files, so which linters and rules are processed is a property of the tool rather than of a package: .pkglint.yaml tunes severities and can silence a rule with an ignored impact, but it cannot switch one on or off. That membership is declared in code, alongside the linters themselves.

const (
	// ScopeStatic verifies a package directory on disk, i.e. the full source tree.
	ScopeStatic Scope = "static"
	// ScopeBundle verifies the bundle image, which carries the renderable package:
	// charts, templates, openapi, docs, metadata and a generated .helmignore.
	ScopeBundle Scope = "bundle"
	// ScopeRelease verifies the release image, which carries release metadata only:
	// version.json, package.yaml, changelog.yaml, openapi, docs and the icon.
	ScopeRelease Scope = "release"
)

type Scopes added in v0.33.5

type Scopes []Scope

Scopes is a set of verification scopes.

func (Scopes) Contains added in v0.33.5

func (s Scopes) Contains(scope Scope) bool

Contains reports whether scope is a member of s.

type Target added in v0.33.5

type Target struct {
	// Type is the kind of package, taken from package.yaml.
	Type PackageType
	// Scope is the source the package is read from.
	Scope Scope
}

Target identifies one verification pass: the kind of package being verified and the source it is read from. Linters and rules declare which targets they are processed in.

func (Target) String added in v0.33.5

func (t Target) String() string

String renders the target as "<type>/<scope>" for diagnostics and errors.

type TypeScopes added in v0.33.5

type TypeScopes map[PackageType]Scopes

TypeScopes declares, per package type, the scopes a linter or rule is processed in. A package type absent from the map is not processed at all, so adding a package type is a deliberate act: every linter has to opt into it.

func EveryType added in v0.33.5

func EveryType(scopes ...Scope) TypeScopes

EveryType applies the same scopes to every package type. Use it for linters and rules whose applicability depends only on which files a source carries, not on the kind of package; spell the map out instead when the two types genuinely differ.

func (TypeScopes) Contains added in v0.33.5

func (t TypeScopes) Contains(target Target) bool

Contains reports whether target is covered by t.

Directories

Path Synopsis
Package doc serves the reference documentation for the verify linters and their rules, as printed by `package doc`.
Package doc serves the reference documentation for the verify linters and their rules, as printed by `package doc`.
linters
icon
Package icon validates package-icon content (format, size, dimensions).
Package icon validates package-icon content (format, size, dimensions).
openapi
Package openapi validates the OpenAPI schemas a package ships under openapi/.
Package openapi validates the OpenAPI schemas a package ships under openapi/.
oss
Package oss validates optional oss.yaml package metadata.
Package oss validates optional oss.yaml package metadata.
package
Package pkglint holds the linter that inspects the package as an artifact: the shape of its root, and the metadata that describes it.
Package pkglint holds the linter that inspects the package as an artifact: the shape of its root, and the metadata that describes it.
Package settings maps the on-disk .pkglint.yaml document onto typed configuration and converts it into runtime-ready linter severities.
Package settings maps the on-disk .pkglint.yaml document onto typed configuration and converts it into runtime-ready linter severities.

Jump to

Keyboard shortcuts

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