linter

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linter

type Linter interface {
	Lint(Package) error
}

A Linter lints packages.

type ObjectLinterFn

type ObjectLinterFn func(runtime.Object) error

ObjectLinterFn lints an object in a package.

func ObjectLinterFns

func ObjectLinterFns(fns ...ObjectLinterFn) []ObjectLinterFn

ObjectLinterFns is a convenience function to pass multiple ObjectLinterFn to a function that cannot accept variadic arguments.

func Or

func Or(linters ...ObjectLinterFn) ObjectLinterFn

Or checks that at least one of the passed linter functions does not return an error.

type Package

type Package interface {
	GetMeta() []runtime.Object
	GetObjects() []runtime.Object
}

Package defines the common API for lintable packages.

type PackageLinter

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

PackageLinter lints packages by applying package and object linter functions to it.

func NewPackageLinter

func NewPackageLinter(pre []PackageLinterFn, perMeta, perObject []ObjectLinterFn) *PackageLinter

NewPackageLinter creates a new PackageLinter.

func (*PackageLinter) Lint

func (l *PackageLinter) Lint(pkg Package) error

Lint executes all linter functions against a package.

type PackageLinterFn

type PackageLinterFn func(Package) error

PackageLinterFn lints an entire package. If function applies a check for multiple objects, consider using an ObjectLinterFn.

func PackageLinterFns

func PackageLinterFns(fns ...PackageLinterFn) []PackageLinterFn

PackageLinterFns is a convenience function to pass multiple PackageLinterFn to a function that cannot accept variadic arguments.

Jump to

Keyboard shortcuts

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