lint

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Overview

Package lint contains functions for verifying zarf yaml files are valid

Package lint contains functions for verifying zarf yaml files are valid

Package lint contains functions for verifying zarf yaml files are valid

Package lint contains functions for verifying zarf yaml files are valid

Index

Constants

This section is empty.

Variables

View Source
var ZarfSchema fs.ReadFileFS

ZarfSchema is exported so main.go can embed the schema file

Functions

func GroupFindingsByPath

func GroupFindingsByPath(findings []PackageFinding, packageName string) map[string][]PackageFinding

GroupFindingsByPath groups findings by their package path

func HasSevOrHigher

func HasSevOrHigher(findings []PackageFinding, severity Severity) bool

HasSevOrHigher returns true if the findings contain a severity equal to or greater than the given severity

func PrintFindings

func PrintFindings(findings []PackageFinding, severity Severity, baseDir string, packageName string)

PrintFindings prints the findings of the given severity in a table

func Validate

func Validate(ctx context.Context, createOpts types.ZarfCreateOptions) error

Validate lints the given Zarf package

Types

type PackageFinding

type PackageFinding struct {
	// YqPath is the path to the key where the error originated from, this is sometimes empty in the case of a general error
	YqPath      string
	Description string
	// Item is the value of a key that is causing an error, for example a bad image name
	Item string
	// PackageNameOverride shows the name of the package that the error originated from
	// If it is not set the base package will be used when displaying the error
	PackageNameOverride string
	// PackagePathOverride shows the path to the package that the error originated from
	// If it is not set the base package will be used when displaying the error
	PackagePathOverride string
	Severity            Severity
}

PackageFinding is a struct that contains a finding about something wrong with a package

func CheckComponentValues

func CheckComponentValues(c types.ZarfComponent, i int) []PackageFinding

CheckComponentValues runs lint rules validating values on component keys, should be run after templating

func ValidatePackageSchema

func ValidatePackageSchema() ([]PackageFinding, error)

ValidatePackageSchema checks the Zarf package in the current directory against the Zarf schema

type Severity

type Severity int

Severity is the type of finding

const (
	SevErr Severity = iota + 1
	SevWarn
)

different severities of package errors

Jump to

Keyboard shortcuts

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