linter

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 10 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 string

Code representing the problem identified by the linter Recommended to use the pattern MIXIN-NUMBER so that you don't collide with codes from another mixin or with Porter's codes. Example: - exec-105 - helm-410

type Level

type Level int

Level of severity for a lint result.

const (
	// LevelError indicates a lint result is an error that will prevent the bundle from building properly.
	LevelError Level = 0

	// LevelWarning indicates a lint result is a warning about a best practice or identifies a problem that is not
	// guaranteed to break the build.
	LevelWarning Level = 2
)

func (Level) String

func (l Level) String() string

type Linter

type Linter struct {
	*portercontext.Context
	Mixins pkgmgmt.PackageManager
}

Linter manages executing the lint command for all affected mixins and reporting the results.

func New

func (*Linter) Lint

func (l *Linter) Lint(ctx context.Context, m *manifest.Manifest) (Results, error)

type Location

type Location struct {
	// Action containing the step, e.g. Install.
	Action string

	// Mixin name, e.g. exec.
	Mixin string

	// StepNumber is the position of the step, starting from 1, within the action.
	// Example
	// install:
	//  - exec: (1)
	//     ...
	//  - helm3: (2)
	//     ...
	//  - exec: (3)
	//     ...
	StepNumber int

	// StepDescription is the description of the step provided in the manifest.
	// Example
	// install:
	//  - exec:
	//      description: THIS IS THE STEP DESCRIPTION
	//      command: ./helper.sh
	StepDescription string
}

Location identifies the offending mixin step within a manifest.

func (Location) String

func (l Location) String() string

type Result

type Result struct {
	// Level of severity
	Level Level

	// Location of the problem in the manifest.
	Location Location

	// Code uniquely identifying the type of problem.
	Code Code

	// Title to display (80 chars).
	Title string

	// Message explaining the problem.
	Message string

	// URL that provides additional assistance with this problem.
	URL string
}

Result is a single item identified by the linter.

func (Result) String

func (r Result) String() string

type Results

type Results []Result

Results is a set of items identified by the linter.

func (Results) HasError

func (r Results) HasError() bool

HasError checks if any of the results is an error.

func (Results) String

func (r Results) String() string

Jump to

Keyboard shortcuts

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