Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶ added in v0.10.0
An Aggregate is data collected by some rule while processing a file AST, to be used later by other rules needing a global context (i.e. broader than per-file) Rule authors are expected to collect the minimum needed data, to avoid performance problems while working with large Rego code repositories.
func (Aggregate) IndexKey ¶ added in v0.28.0
IndexKey is the category/title of the rule that generated the aggregate. This key is generated in Rego during linting, this function replicates the functionality in Go for use in the cache when indexing aggregates.
func (Aggregate) SourceFile ¶ added in v0.28.0
type Location ¶
type Location struct { End *Position `json:"end,omitempty"` Text *string `json:"text,omitempty"` File string `json:"file"` Column int `json:"col"` Row int `json:"row"` Offset int `json:"offset,omitempty"` }
Location provides information on the location of a violation. End attribute added in v0.24.0 and ideally we'd have a Start attribute the same way. But as opposed to adding an optional End attribute, changing the structure of the existing struct would break all existing API clients.
type Notice ¶ added in v0.12.0
type Notice struct { Title string `json:"title"` Description string `json:"description"` Category string `json:"category"` Level string `json:"level"` Severity string `json:"severity"` }
Notice describes any notice found by Regal.
type ProfileEntry ¶ added in v0.10.0
type ProfileEntry struct { Location string `json:"location"` TotalTimeNs int64 `json:"total_time_ns"` NumEval int `json:"num_eval"` NumRedo int `json:"num_redo"` NumGenExpr int `json:"num_gen_expr"` }
ProfileEntry is a single entry of profiling information, keyed by location. This data may have been aggregated across multiple runs.
type RelatedResource ¶
type RelatedResource struct { Description string `json:"description"` Reference string `json:"ref"` }
RelatedResource provides documentation on a violation.
type Report ¶
type Report struct { // We don't have aggregates when publishing the final report (see JSONReporter), so omitempty is needed here // to avoid surfacing a null/empty field. Aggregates map[string][]Aggregate `json:"aggregates,omitempty"` Metrics map[string]any `json:"metrics,omitempty"` AggregateProfile map[string]ProfileEntry `json:"-"` IgnoreDirectives map[string]map[string][]string `json:"ignore_directives,omitempty"` Violations []Violation `json:"violations"` Notices []Notice `json:"notices,omitempty"` Profile []ProfileEntry `json:"profile,omitempty"` Summary Summary `json:"summary"` }
Report aggregate of Violation as returned by a linter run.
func (*Report) AddProfileEntries ¶ added in v0.10.0
func (r *Report) AddProfileEntries(prof map[string]ProfileEntry)
func (*Report) AggregateProfileToSortedProfile ¶ added in v0.10.0
func (Report) ViolationsFileCount ¶
ViolationsFileCount returns the number of files containing violations.
type Violation ¶
type Violation struct { Title string `json:"title"` Description string `json:"description"` Category string `json:"category"` Level string `json:"level"` RelatedResources []RelatedResource `json:"related_resources,omitempty"` Location Location `json:"location,omitempty"` IsAggregate bool `json:"-"` }
Violation describes any violation found by Regal.