checks

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SeverityError = 0
View Source
var SeverityInfo = 2
View Source
var SeverityStyle = 3
View Source
var SeverityWarning = 1

Functions

func HasProjectPoliciesOnDisk added in v1.1.0

func HasProjectPoliciesOnDisk(path string) bool

func RegisterProjectPolicies added in v1.1.0

func RegisterProjectPolicies(path string)

func RegisterRemoteOPABundleChecks added in v1.2.0

func RegisterRemoteOPABundleChecks(bundleURLs []string)

func RunChecksInParallel

func RunChecksInParallel(checks []Check, checkInput CheckInput, errHandler func(error)) chan []CheckFinding

RunChecksInParallel for the given input and handle errors with the callback provided Output is provided in a unbuffered channel that is closed once all checks finished

func SeverityLevelToName

func SeverityLevelToName(level int) string

func SeverityNameToLevel

func SeverityNameToLevel(name string) int

Types

type BundleCheck added in v1.1.0

type BundleCheck struct {
	BundlePath string
}

func (BundleCheck) Run added in v1.1.0

func (r BundleCheck) Run(i *CheckInput) ([]CheckFinding, error)

type Check

type Check interface {
	// Run the check
	Run(i *CheckInput) ([]CheckFinding, error)
}

Check that runs verifications

func AllChecks

func AllChecks() []Check

AllChecks available

type CheckFinding

type CheckFinding struct {
	Severity int
	Code     string
	Line     int
	Message  string
	Link     string
	File     string
}

func (*CheckFinding) Compare

func (cf *CheckFinding) Compare(o CheckFinding) int

func (*CheckFinding) Location

func (cf *CheckFinding) Location() (string, error)

func (*CheckFinding) SeverityName

func (cf *CheckFinding) SeverityName() string

type CheckInput

type CheckInput struct {
	// CiYaml contains the yaml configuration in different representations as loaded from the file system
	CiYaml *CiYaml
	// Configuration used to execute the verifier
	Configuration *cli.Configuration
	// LintAPIResult contains the API response from the GitLab CI Lint API. It might be not set when configuration
	// disabled ci validation inside CI
	LintAPIResult *ci_yaml.VerificationResultWithRemoteInfo
	// MergedCiYaml contains the merged yaml when the lint api result is available
	MergedCiYaml *CiYaml
}

func (*CheckInput) CanProvideMergedYaml added in v1.0.0

func (c *CheckInput) CanProvideMergedYaml() bool

func (*CheckInput) HasLintAPIResult added in v1.0.0

func (c *CheckInput) HasLintAPIResult() bool

type CiYaml

type CiYaml struct {
	FileContent   []byte
	ParsedYamlMap map[string]any
	ParsedYamlDoc *yaml.Node
}

func NewCiYaml

func NewCiYaml(content []byte) (*CiYaml, error)

NewCiYaml from byte contents

type GitlabPagesJobCheck

type GitlabPagesJobCheck struct {
	InMemoryCheck
}

func NewGitlabPagesJobCheck added in v1.1.0

func NewGitlabPagesJobCheck() GitlabPagesJobCheck

type InMemoryCheck added in v1.1.0

type InMemoryCheck struct {
	RegoContent string
}

func (InMemoryCheck) Run added in v1.1.0

func (im InMemoryCheck) Run(i *CheckInput) ([]CheckFinding, error)

type ModuleCheck added in v1.1.0

type ModuleCheck struct {
	ModulePath string
}

func (ModuleCheck) Run added in v1.1.0

func (m ModuleCheck) Run(i *CheckInput) ([]CheckFinding, error)

type PipelineLintApiCheck

type PipelineLintApiCheck struct {
}

func (PipelineLintApiCheck) Run

type RemoteBundleCheck added in v1.2.0

type RemoteBundleCheck struct {
	BundleURL string
}

func (RemoteBundleCheck) Run added in v1.2.0

type ShellScriptCheck

type ShellScriptCheck struct {
}

func (ShellScriptCheck) Run

Jump to

Keyboard shortcuts

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