Documentation
¶
Overview ¶
Package cover reports coverage on modules.
Index ¶
- func NoEarlyExitEvalOptions(cov *Cover, ndbc builtins.NDBCache) []rego.EvalOption
- func NoIndexingEvalOptions(cov *Cover, ndbc builtins.NDBCache) []rego.EvalOption
- type Cover
- func (c *Cover) AddRun(kind Kind, supplementary *Cover)
- func (*Cover) Config() topdown.TraceConfig
- func (*Cover) Enabled() bool
- func (c *Cover) Report(modules map[string]*ast.Module) (report Report)
- func (c *Cover) Trace(event *topdown.Event)deprecated
- func (c *Cover) TraceEvent(event topdown.Event)
- type CoverageThresholdError
- type FileReport
- type Kind
- type Position
- type PositionSlicedeprecated
- func (sl PositionSlice) Sort()deprecated
- type Range
- type Report
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NoEarlyExitEvalOptions ¶ added in v1.20.0
func NoEarlyExitEvalOptions(cov *Cover, ndbc builtins.NDBCache) []rego.EvalOption
NoEarlyExitEvalOptions is NoIndexingEvalOptions' early-exit-disabled counterpart.
func NoIndexingEvalOptions ¶ added in v1.20.0
func NoIndexingEvalOptions(cov *Cover, ndbc builtins.NDBCache) []rego.EvalOption
NoIndexingEvalOptions returns the rego.EvalOptions for a supplementary pass that traces into cov with rule indexing disabled, replaying the non-deterministic builtin results captured in ndbc.
Types ¶
type Cover ¶
type Cover struct {
// contains filtered or unexported fields
}
Cover computes and reports on coverage.
func (*Cover) AddRun ¶ added in v1.20.0
AddRun registers supplementary as a Cover populated by evaluating the same query with e.g. indexing or early exit disabled. In Report, any range that's NotCovered but Covered in supplementary is tagged with kind.
func (*Cover) Config ¶
func (*Cover) Config() topdown.TraceConfig
Config returns the standard Tracer configuration for the Cover tracer
func (*Cover) TraceEvent ¶
TraceEvent updates the coverage state.
type CoverageThresholdError ¶
CoverageThresholdError represents an error raised when the global code coverage percentage is lower than the specified threshold.
func (*CoverageThresholdError) Error ¶
func (e *CoverageThresholdError) Error() string
type FileReport ¶
type FileReport struct {
Covered []Range `json:"covered,omitempty"`
NotCovered []Range `json:"not_covered,omitempty"`
CoveredLines int `json:"covered_lines,omitempty"`
NotCoveredLines int `json:"not_covered_lines,omitempty"`
Coverage float64 `json:"coverage,omitempty"`
}
FileReport represents a coverage report for a single file.
func (*FileReport) IsCovered ¶
func (fr *FileReport) IsCovered(row int) bool
IsCovered returns true if the row is marked as covered in the report.
func (*FileReport) IsNotCovered ¶
func (fr *FileReport) IsNotCovered(row int) bool
IsNotCovered returns true if the row is marked as NOT covered in the report. This is not the same as simply not being reported. For example, certain statements like imports are not included in the report.
type PositionSlice
deprecated
type PositionSlice []Position
PositionSlice is a collection of position that can be sorted.
Deprecated: PositionSlice is unused inside OPA and will be removed in a future release.
func (PositionSlice) Sort
deprecated
func (sl PositionSlice) Sort()
Sort sorts the slice by row, then column.
Deprecated: see PositionSlice.
type Range ¶
type Range struct {
Start Position `json:"start"`
End Position `json:"end"`
Kinds []Kind `json:"kinds,omitempty"`
}
Range represents a range of positions in a file. Kinds categorizes why a range was not covered, e.g. KindIndexExcluded; it's empty when covered or the reason is unknown, and can hold more than one Kind.