linter

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelInfo must be used for results that can be safely
	// ignore by the caller of the Linter.
	LevelInfo = Level("INFO")

	// LevelWarning must be used to indicated result
	// that must be brough to the attention of the
	// caller of the Linter.
	LevelWarning = Level("WARN")

	// LevelError is used to signal errors to the
	// caller of the Linter.
	LevelError = Level("ERR")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level string

Level indicates the importance of results returned by implementations of the RolesLinter interface.

type Linter

type Linter interface {
	Lint(context.Context, *types.Requirements, chan<- Result) error
}

A Linter analyzes Ansible requirements definitions and provides linting feedback in form of Result.

type Result

type Result struct {
	// The role evaluated by the Linter.
	Role types.Role

	// The level of severity of the
	// Linter result.
	Level Level

	// The detailed error returned
	// by the Linter for propagation
	// to the caller.
	// Note that errors should be considered to be
	// blocking only when the Level is set to LevelError.
	Err error

	// Implementation specific
	// Linter Metadata.
	Metadata interface{}
}

Result holds the RolesLinter evaluation on a given role dependency declaration.

type Update

type Update struct {
	// FromVersion represents the current version of the role.
	FromVersion string

	// ToVersion is a more recent version for a role.
	ToVersion string

	// IsUpdate is true if an update has been found for the role.
	IsUpdate bool
}

Update represents an Ansible role update.

type UpdatesLinter

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

UpdatesLinter checks for updates for roles declarations.

func NewUpdatesLinter

func NewUpdatesLinter() *UpdatesLinter

NewUpdatesLinter returns a new UpdatesLinter.

func (*UpdatesLinter) Lint

func (u *UpdatesLinter) Lint(ctx context.Context, requirements *types.Requirements, output chan<- Result) error

Lint checks for updates to the Roles defined in the given Requirements. Linter Results will be sent on the output channel. In case an update exists for a given Role, the corresponding Result will have the Metadata field set to an Update holding additional information on the new version available for the role.

func (*UpdatesLinter) WithAnsibleGalaxyURL

func (u *UpdatesLinter) WithAnsibleGalaxyURL(url string)

WithAnsibleGalaxyURL configures the UpdatesLinter to use the given URL for Ansible Galaxy instead of the default one.

Jump to

Keyboard shortcuts

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