linter

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linter

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

Linter stores data to use for linting.

func NewLinter

func NewLinter() Linter

NewLinter creates a new Regal linter.

func (Linter) DetermineEnabledRules added in v0.21.0

func (l Linter) DetermineEnabledRules(ctx context.Context) ([]string, error)

DetermineEnabledRules returns the list of rules that are enabled based on the supplied configuration. This makes use of the Rego and Go rule settings to produce a single list of the rules that are to be run on this linter instance.

func (Linter) Lint

func (l Linter) Lint(ctx context.Context) (report.Report, error)

Lint runs the linter on provided policies.

func (Linter) WithAddedBundle

func (l Linter) WithAddedBundle(b bundle.Bundle) Linter

WithAddedBundle adds a bundle of rules and data to include in evaluation.

func (Linter) WithCustomRules

func (l Linter) WithCustomRules(paths []string) Linter

WithCustomRules adds custom rules for evaluation, from the Rego (and data) files provided at paths.

func (Linter) WithCustomRulesFromFS added in v0.14.0

func (l Linter) WithCustomRulesFromFS(f fs.FS, rootPath string) Linter

WithCustomRulesFromFS adds custom rules for evaluation from a filesystem implementing the fs.FS interface. A rootpath within the filesystem must also be specified. Note, _test.rego files will be ignored.

func (Linter) WithDebugMode added in v0.8.0

func (l Linter) WithDebugMode(debugMode bool) Linter

WithDebugMode enables debug mode.

func (Linter) WithDisableAll

func (l Linter) WithDisableAll(disableAll bool) Linter

WithDisableAll disables all rules when set to true. This overrides configuration provided in file.

func (Linter) WithDisabledCategories

func (l Linter) WithDisabledCategories(disableCategory ...string) Linter

WithDisabledCategories disables provided categories of rules. This overrides configuration provided in file.

func (Linter) WithDisabledRules

func (l Linter) WithDisabledRules(disable ...string) Linter

WithDisabledRules disables provided rules. This overrides configuration provided in file.

func (Linter) WithEnableAll

func (l Linter) WithEnableAll(enableAll bool) Linter

WithEnableAll enables all rules when set to true. This overrides configuration provided in file.

func (Linter) WithEnabledCategories

func (l Linter) WithEnabledCategories(enableCategory ...string) Linter

WithEnabledCategories enables provided categories of rules. This overrides configuration provided in file.

func (Linter) WithEnabledRules

func (l Linter) WithEnabledRules(enable ...string) Linter

WithEnabledRules enables provided rules. This overrides configuration provided in file.

func (Linter) WithIgnore added in v0.5.0

func (l Linter) WithIgnore(ignore []string) Linter

WithIgnore excludes files matching patterns. This overrides configuration provided in file.

func (Linter) WithInputModules added in v0.8.0

func (l Linter) WithInputModules(input *rules.Input) Linter

WithInputModules sets the input modules to lint. This is used for programmatic access, where you don't necessarily want to lint *files*.

func (Linter) WithInputPaths added in v0.8.0

func (l Linter) WithInputPaths(paths []string) Linter

WithInputPaths sets the inputPaths to lint. Note that these will be filtered according to the ignore options.

func (Linter) WithMetrics added in v0.9.0

func (l Linter) WithMetrics(m metrics.Metrics) Linter

WithMetrics enables metrics collection.

func (Linter) WithPrintHook added in v0.10.0

func (l Linter) WithPrintHook(printHook print.Hook) Linter

func (Linter) WithProfiling added in v0.10.0

func (l Linter) WithProfiling(enabled bool) Linter

WithProfiling enables profiling metrics.

func (Linter) WithRootDir added in v0.20.0

func (l Linter) WithRootDir(rootDir string) Linter

WithRootDir sets the root directory for the linter. A door directory or prefix can be use to resolve relative paths referenced in the linter configuration with absolute file paths or URIs.

func (Linter) WithUserConfig

func (l Linter) WithUserConfig(cfg config.Config) Linter

WithUserConfig provides config overrides set by the user.

Jump to

Keyboard shortcuts

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