executor

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

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

Executor scans HCL blocks by running all registered rules against them

func New

func New(options ...Option) *Executor

New creates a new Executor

func (*Executor) Execute

func (e *Executor) Execute(modules terraform.Modules) (rules.Results, Metrics, error)

type Job

type Job interface {
	Run() (rules.Results, error)
}

type Metrics

type Metrics struct {
	Timings struct {
		Adaptation    time.Duration
		RunningChecks time.Duration
	}
	Counts struct {
		Ignored  int
		Failed   int
		Passed   int
		Critical int
		High     int
		Medium   int
		Low      int
	}
}

type Option

type Option func(s *Executor)

func OptionExcludeRules

func OptionExcludeRules(ruleIDs []string) Option

func OptionIncludeRules

func OptionIncludeRules(ruleIDs []string) Option

func OptionNoIgnores added in v0.19.0

func OptionNoIgnores() Option

func OptionStopOnErrors

func OptionStopOnErrors(stop bool) Option

func OptionWithAlternativeIDProvider

func OptionWithAlternativeIDProvider(f func(string) string) Option

func OptionWithDebugWriter

func OptionWithDebugWriter(w io.Writer) Option

func OptionWithRegoScanner added in v0.19.0

func OptionWithRegoScanner(s *rego.Scanner) Option

func OptionWithResultsFilter

func OptionWithResultsFilter(f func(rules.Results) rules.Results) Option

func OptionWithSeverityOverrides

func OptionWithSeverityOverrides(overrides map[string]string) Option

func OptionWithSingleThread

func OptionWithSingleThread(single bool) Option

func OptionWithWorkspaceName

func OptionWithWorkspaceName(workspaceName string) Option

type Pool

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

func NewPool

func NewPool(size int, rules []rules.RegisteredRule, modules terraform.Modules, state *state.State, ignoreErrors bool, regoScanner *rego.Scanner) *Pool

func (*Pool) Run

func (p *Pool) Run() (rules.Results, error)

Run runs the job in the pool - this will only return an error if a job panics

type Statistics

type Statistics []StatisticsItem

func AddStatisticsCount

func AddStatisticsCount(statistics Statistics, result rules.Result) Statistics

func SortStatistics

func SortStatistics(statistics Statistics) Statistics

func (Statistics) PrintStatisticsTable

func (statistics Statistics) PrintStatisticsTable()

type StatisticsItem

type StatisticsItem struct {
	RuleID          string
	RuleDescription string
	Links           []string
	Count           int
}

type Worker

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

func NewWorker

func NewWorker(incoming <-chan Job) *Worker

func (*Worker) Error

func (w *Worker) Error() error

func (*Worker) Start

func (w *Worker) Start()

func (*Worker) Wait

func (w *Worker) Wait() rules.Results

Jump to

Keyboard shortcuts

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