rules

package
v0.21.5 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code struct {
	Message  string `yaml:"message"`
	Severity Level  `yaml:"severity"`
}

Code represents an issue code.

func (*Code) Format

func (c *Code) Format(code ID, args ...any) string

Format hydrates a message with arguments.

type CodeOverride

type CodeOverride struct {
	ID       ID     `yaml:"code"`
	Message  string `yaml:"message"`
	Severity Level  `yaml:"severity"`
}

type Exclude

type Exclude struct {
	FQNs        expressions `yam:"FQNs"`
	Labels      keyVals     `yaml:"labels"`
	Annotations keyVals     `yaml:"annotations"`
	Codes       expressions `yaml:"codes"`
	Containers  expressions `yaml:"containers"`
}

func NewExclude

func NewExclude() Exclude

NewExclude returns a new instance.

func (Exclude) Dump

func (e Exclude) Dump(indent string)

func (Exclude) Match

func (e Exclude) Match(spec Spec, global bool) bool

Match checks if a given named resource should be Excluded.

func (Exclude) String

func (e Exclude) String() string

type Excludes

type Excludes []Exclude

func (Excludes) Dump

func (ee Excludes) Dump(indent string)

func (Excludes) Match

func (ee Excludes) Match(spec Spec, global bool) bool

type Exclusions

type Exclusions struct {
	// Excludes tracks exclusions
	Global Exclude `yaml:"global"`

	// Linters tracks exclusions
	Linters Linters `yaml:"linters"`
}

func NewExclusions

func NewExclusions() Exclusions

func (Exclusions) Dump

func (e Exclusions) Dump()

func (Exclusions) Match

func (e Exclusions) Match(spec Spec) bool

type Expression

type Expression string

func (Expression) IsRX

func (e Expression) IsRX() bool

func (Expression) MatchRX

func (e Expression) MatchRX(s string) bool

type Glossary

type Glossary map[ID]*Code

Glossary represents a collection of codes.

type ID

type ID int

ID represents a issue code identifier.

const ZeroCode ID = 0

func (ID) String

func (i ID) String() string

type IDS

type IDS map[Code]struct{}

IDS tracks a collection of ids.

type Labels

type Labels map[string]string

func (Labels) String

func (l Labels) String() string

type Level

type Level int

Level tracks lint check level.

const (
	// OkLevel denotes no linting issues.
	OkLevel Level = iota
	// InfoLevel denotes FIY linting issues.
	InfoLevel
	// WarnLevel denotes a warning issue.
	WarnLevel
	// ErrorLevel denotes a serious issue.
	ErrorLevel
)

func ToIssueLevel

func ToIssueLevel(level *string) Level

ToIssueLevel convert a string to a issue level.

func (Level) ToHumanLevel

func (l Level) ToHumanLevel() string

type LinterExcludes

type LinterExcludes struct {
	Codes     expressions `yaml:"codes"`
	Instances Excludes    `yaml:"instances"`
}

func (LinterExcludes) Dump

func (l LinterExcludes) Dump(indent string)

func (LinterExcludes) Match

func (l LinterExcludes) Match(spec Spec, global bool) bool

type Linters

type Linters map[string]LinterExcludes

func (Linters) Dump

func (l Linters) Dump(indent string)

func (Linters) Match

func (l Linters) Match(spec Spec, global bool) bool

type Overrides

type Overrides []CodeOverride

Glossary represents a collection of codes.

type Spec

type Spec struct {
	GVR         types.GVR
	FQN         string
	Labels      Labels
	Annotations Labels
	Containers  []string
	Code        ID
}

Spec tracks an issue spec

func (Spec) String

func (s Spec) String() string

Jump to

Keyboard shortcuts

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