Documentation
¶
Index ¶
- type Input
- func InputFromPaths(paths []string, versionsMap map[string]ast.RegoVersion) (Input, error)
- func InputFromText(fileName, text string) (Input, error)
- func InputFromTextWithOptions(fileName, text string, opts ast.ParserOptions) (Input, error)
- func NewInput(fileContent map[string]string, modules map[string]*ast.Module) Input
- type OpaFmtRule
- type Rule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Input ¶
type Input struct { // FileContent carries the string contents of each file FileContent map[string]string // Modules is the set of modules to lint. Modules map[string]*ast.Module // FileNames is used to maintain consistent order between runs. FileNames []string }
Input represents the input for a linter evaluation.
func InputFromPaths ¶
InputFromPaths creates a new Input from a set of file or directory paths. Note that this function assumes that the paths point to valid Rego files. Use config.FilterIgnoredPaths to filter out unwanted content *before* calling this function. When the versionsMap is not nil/empty, files in a directory matching a key in the map will be parsed with the corresponding Rego version. If not provided, the file may be parsed multiple times in order to determine the version (best-effort and may include false positives).
func InputFromText ¶ added in v0.9.0
InputFromText creates a new Input from raw Rego text.
func InputFromTextWithOptions ¶ added in v0.30.0
func InputFromTextWithOptions(fileName, text string, opts ast.ParserOptions) (Input, error)
InputFromTextWithOptions creates a new Input from raw Rego text while respecting the provided options.
type OpaFmtRule ¶
type OpaFmtRule struct {
// contains filtered or unexported fields
}
func NewOpaFmtRule ¶
func NewOpaFmtRule(conf config.Config) *OpaFmtRule
func (*OpaFmtRule) Category ¶
func (*OpaFmtRule) Category() string
func (*OpaFmtRule) Config ¶
func (f *OpaFmtRule) Config() config.Rule
func (*OpaFmtRule) Description ¶
func (*OpaFmtRule) Description() string
func (*OpaFmtRule) Documentation ¶
func (*OpaFmtRule) Documentation() string
func (*OpaFmtRule) Name ¶
func (*OpaFmtRule) Name() string
type Rule ¶
type Rule interface { // Run runs the rule on the provided input. Run(context.Context, Input) (*report.Report, error) // Name returns the name of the rule. Name() string // Category returns the category of the rule. Category() string // Description returns the description of the rule. Description() string // Documentation returns the documentation URL for the rule. Documentation() string // Config returns the provided configuration for the rule Config() config.Rule }
Rule represents a linter rule.