executor

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 24 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 OptionExcludeIgnores added in v0.0.2

func OptionExcludeIgnores(ruleIDs []string) Option

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 OptionWithFrameworks added in v0.0.2

func OptionWithFrameworks(frameworks ...framework.Framework) Option

func OptionWithRegoOnly

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(format string, w io.Writer) error

type StatisticsItem

type StatisticsItem struct {
	RuleID          string   `json:"rule_id"`
	RuleDescription string   `json:"rule_description"`
	Links           []string `json:"links"`
	Count           int      `json:"count"`
}

type StatisticsResult added in v0.0.2

type StatisticsResult struct {
	Result Statistics `json:"results"`
}

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