Documentation
¶
Index ¶
- type Linter
- func (l Linter) DetermineEnabledRules(ctx context.Context) ([]string, []string, error)
- func (l Linter) GetConfig() (*config.Config, error)
- func (l Linter) Lint(ctx context.Context) (report.Report, error)
- func (l Linter) MustPrepare(ctx context.Context) Linter
- func (l Linter) Prepare(ctx context.Context) (Linter, error)
- func (l Linter) WithAddedBundle(b *bundle.Bundle) Linter
- func (l Linter) WithAggregates(aggregates map[string][]report.Aggregate) Linter
- func (l Linter) WithBaseCache(baseCache topdown.BaseCache) Linter
- func (l Linter) WithCollectQuery(enabled bool) Linter
- func (l Linter) WithCustomRules(paths []string) Linter
- func (l Linter) WithCustomRulesFromFS(f fs.FS, rootPath string) Linter
- func (l Linter) WithDebugMode(debugMode bool) Linter
- func (l Linter) WithDisableAll(disableAll bool) Linter
- func (l Linter) WithDisabledCategories(disableCategory ...string) Linter
- func (l Linter) WithDisabledRules(disable ...string) Linter
- func (l Linter) WithEnableAll(enableAll bool) Linter
- func (l Linter) WithEnabledCategories(enableCategory ...string) Linter
- func (l Linter) WithEnabledRules(enable ...string) Linter
- func (l Linter) WithExportAggregates(enabled bool) Linter
- func (l Linter) WithIgnore(ignore []string) Linter
- func (l Linter) WithInputModules(input *rules.Input) Linter
- func (l Linter) WithInputPaths(paths []string) Linter
- func (l Linter) WithInstrumentation(enabled bool) Linter
- func (l Linter) WithMetrics(m metrics.Metrics) Linter
- func (l Linter) WithPathPrefix(pathPrefix string) Linter
- func (l Linter) WithPrintHook(printHook print.Hook) Linter
- func (l Linter) WithProfiling(enabled bool) Linter
- func (l Linter) WithUserConfig(cfg config.Config) Linter
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 NewEmptyLinter ¶
func NewEmptyLinter() Linter
NewEmptyLinter creates a linter with no rule bundles.
func (Linter) DetermineEnabledRules ¶
DetermineEnabledRules returns the list of rules that are enabled based on the supplied configuration. This makes use of the linter rule settings to produce a single list of the rules that are to be run on this linter instance.
func (Linter) GetConfig ¶
GetConfig returns the final configuration for the linter, i.e. Regal's default configuration plus any user-provided configuration merged on top of it.
func (Linter) MustPrepare ¶
MustPrepare prepares the linter and panics on errors. Mostly used for tests. Experimental: see description of Prepare.
func (Linter) Prepare ¶
Prepare stores linter preparation state, like the determined configuration, and the query perpared for linting. Experimental: while used internally, the details of what is prepared here are very likely to change in the future, and this method should not yet be relied on by external clients.
func (Linter) WithAddedBundle ¶
WithAddedBundle adds a bundle of rules and data to include in evaluation.
func (Linter) WithAggregates ¶
WithAggregates supplies aggregate data to a linter instance. Likely generated in a previous run, and used to provide a global context to a subsequent run of a single file lint.
func (Linter) WithBaseCache ¶
WithBaseCache sets the base cache (cache for "JSON" documents) to use for evaluation. This feature is **experimental** and should not be relied on by external clients for the time being.
func (Linter) WithCollectQuery ¶
WithCollectQuery forcibly enables the collect query even when there is only one file to lint.
func (Linter) WithCustomRules ¶
WithCustomRules adds custom rules for evaluation, from the Rego (and data) files provided at paths.
func (Linter) WithCustomRulesFromFS ¶
WithCustomRulesFromFS adds custom rules for evaluation from a filesystem implementing the fs.FS interface. A root path within the filesystem must also be specified. Note, _test.rego files will be ignored.
func (Linter) WithDebugMode ¶
WithDebugMode enables debug mode.
func (Linter) WithDisableAll ¶
WithDisableAll disables all rules when set to true. This overrides configuration provided in file.
func (Linter) WithDisabledCategories ¶
WithDisabledCategories disables provided categories of rules. This overrides configuration provided in file.
func (Linter) WithDisabledRules ¶
WithDisabledRules disables provided rules. This overrides configuration provided in file.
func (Linter) WithEnableAll ¶
WithEnableAll enables all rules when set to true. This overrides configuration provided in file.
func (Linter) WithEnabledCategories ¶
WithEnabledCategories enables provided categories of rules. This overrides configuration provided in file.
func (Linter) WithEnabledRules ¶
WithEnabledRules enables provided rules. This overrides configuration provided in file.
func (Linter) WithExportAggregates ¶
WithExportAggregates enables the setting of intermediate aggregate data on the final report. This is useful when you want to collect and aggregate state from multiple different linting runs.
func (Linter) WithIgnore ¶
WithIgnore excludes files matching patterns. This overrides configuration provided in file.
func (Linter) WithInputModules ¶
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 ¶
WithInputPaths sets the inputPaths to lint. Note that these will be filtered according to the ignore options.
func (Linter) WithInstrumentation ¶
WithInstrumentation enables instrumentation metrics.
func (Linter) WithMetrics ¶
WithMetrics enables metrics collection.
func (Linter) WithPathPrefix ¶
WithPathPrefix sets the root path prefix for the linter. A root directory prefix can be used to resolve relative paths referenced in the linter configuration with absolute file paths or URIs.
func (Linter) WithProfiling ¶
WithProfiling enables profiling metrics.