executor

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: MIT Imports: 23 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) (scan.Results, Metrics, error)

type Job

type Job interface {
	Run() (scan.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

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 OptionWithRegoOnly added in v0.35.0

func OptionWithRegoOnly(regoOnly bool) Option

func OptionWithRegoScanner

func OptionWithRegoScanner(s *rego.Scanner) Option

func OptionWithResultsFilter

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

func OptionWithSeverityOverrides

func OptionWithSeverityOverrides(overrides map[string]string) Option

func OptionWithSingleThread

func OptionWithSingleThread(single bool) Option

func OptionWithStateFunc

func OptionWithStateFunc(f ...func(*state.State)) 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 []rules3.RegisteredRule, modules terraform.Modules, state *state.State, ignoreErrors bool, regoScanner *rego.Scanner, regoOnly bool) *Pool

func (*Pool) Run

func (p *Pool) Run() (scan.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 scan.Result) Statistics

func SortStatistics

func SortStatistics(statistics Statistics) Statistics

func (Statistics) PrintStatisticsTable

func (statistics Statistics) PrintStatisticsTable(w io.Writer)

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() scan.Results

Jump to

Keyboard shortcuts

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