report

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: 7 Imported by: 0

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

type Aggregate map[string]any

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.

type Location

type Location struct {
	Column int     `json:"col"`
	Row    int     `json:"row"`
	Offset int     `json:"offset,omitempty"`
	File   string  `json:"file"`
	Text   *string `json:"text,omitempty"`
}

Location provides information on the location of a violation.

func (Location) String

func (l Location) String() string

String shorthand form for a Location.

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 {
	Violations []Violation `json:"violations"`
	// 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"`
	Notices          []Notice                `json:"notices,omitempty"`
	Summary          Summary                 `json:"summary"`
	Metrics          map[string]any          `json:"metrics,omitempty"`
	AggregateProfile map[string]ProfileEntry `json:"-"`
	Profile          []ProfileEntry          `json:"profile,omitempty"`
}

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 (r *Report) AggregateProfileToSortedProfile(numResults int)

func (Report) ViolationsFileCount

func (r Report) ViolationsFileCount() map[string]int

ViolationsFileCount returns the number of files containing violations.

type Summary

type Summary struct {
	FilesScanned  int `json:"files_scanned"`
	FilesFailed   int `json:"files_failed"`
	RulesSkipped  int `json:"rules_skipped"`
	NumViolations int `json:"num_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.

Jump to

Keyboard shortcuts

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