plugin

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(p Plugin) error

Start runs a plugin

Types

type Attribute

type Attribute struct {
	Dir      string            `json:"dir"`
	File     string            `json:"file"`
	Name     string            `json:"name"`
	Metadata map[string]string `json:"metadata"`
}

Attribute defines a single check that is ready for execution

func (Attribute) Check

func (a Attribute) Check() Result

Check runs the Attribute and returns Results

func (Attribute) String

func (a Attribute) String() string

String returns the Result as a human-readable string

type AttributeSet

type AttributeSet []Attribute

AttributeSet defines a group of Attributes

func NewSet

func NewSet(relativeDirs []string) (AttributeSet, error)

NewSet returns a AttributeSet based on a provided list of directories

func (AttributeSet) Check

func (as AttributeSet) Check() ResultSet

Check returns the Results from a AttributeSet by calling Execute on each Attribute

func (AttributeSet) String

func (as AttributeSet) String() string

String returns the AttributeSet as a human-readable string

type LoadInput

type LoadInput struct {
	Dir  string `json:"dir"`
	File string `json:"file"`
}

LoadInput defines the input passed to a plugin to load checks

func (LoadInput) Load

func (l LoadInput) Load() AttributeSet

Load returns an AttributeSet for the provided directory/file

type Plugin

type Plugin interface {
	GetConfigPointer() interface{}
	Load(LoadInput) AttributeSet
	Check(Attribute) Result
	Fix(Result) Result
}

Plugin defines a Golang plugin object for prospectus request handling

type Result

type Result struct {
	Actual    string    `json:"actual"`
	Expected  string    `json:"expected"`
	Matches   bool      `json:"matches"`
	Attribute Attribute `json:"attribute"`
}

Result defines the results of executing a Attribute

func NewErrorResult

func NewErrorResult(msg string) Result

NewErrorResult creates an error result from a given string

func (Result) Fix

func (r Result) Fix() Result

Fix attempts to resolve a mismatched expectation

func (Result) String

func (r Result) String() string

String returns the Result as a human-readable string

type ResultSet

type ResultSet []Result

ResultSet defines a group of Results

func (ResultSet) Fix

func (rs ResultSet) Fix() ResultSet

Fix attempts to fix all results in a ResultSet

func (ResultSet) String

func (rs ResultSet) String() string

String returns the ResultSet as a human-readable string

Jump to

Keyboard shortcuts

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