Documentation ¶
Index ¶
Constants ¶
const ( OutputStandard = "stdout" OutputJSON = "json" OutputTAP = "tap" OutputTable = "table" OutputJUnit = "junit" OutputGitHub = "github" OutputAzureDevOps = "azuredevops" )
The defined output formats represent all of the supported formats that can be used to format and render results.
Variables ¶
This section is empty.
Functions ¶
func ExitCode ¶ added in v0.22.0
func ExitCode(results []CheckResult) int
ExitCode returns the exit code that should be returned given all of the returned results.
func ExitCodeFailOnWarn ¶ added in v0.22.0
func ExitCodeFailOnWarn(results []CheckResult) int
ExitCodeFailOnWarn returns the exit code that should be returned given all of the returned results, and will consider warnings as failures.
Types ¶
type AzureDevOps ¶ added in v0.45.0
type AzureDevOps struct {
// contains filtered or unexported fields
}
AzureDevOps represents an Outputter that outputs results in AzureDevOps Pipelines format. https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands
func NewAzureDevOps ¶ added in v0.45.0
func NewAzureDevOps(w io.Writer) *AzureDevOps
NewAzureDevOps creates a new AzureDevOps with the given writer.
func (*AzureDevOps) Output ¶ added in v0.45.0
func (t *AzureDevOps) Output(checkResults []CheckResult) error
Output outputs the results.
type CheckResult ¶
type CheckResult struct { FileName string `json:"filename"` Namespace string `json:"namespace"` Successes int `json:"successes"` Skipped []Result `json:"skipped,omitempty"` Warnings []Result `json:"warnings,omitempty"` Failures []Result `json:"failures,omitempty"` Exceptions []Result `json:"exceptions,omitempty"` Queries []QueryResult `json:"queries,omitempty"` }
CheckResult describes the result of a conftest policy evaluation. Errors produced by rego should be considered separate from other classes of exceptions.
type GitHub ¶ added in v0.27.0
type GitHub struct {
// contains filtered or unexported fields
}
GitHub represents an Outputter that outputs results in GitHub workflow format. https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions
func (*GitHub) Output ¶ added in v0.27.0
func (t *GitHub) Output(checkResults []CheckResult) error
Output outputs the results.
type JSON ¶ added in v0.22.0
JSON represents an Outputter that outputs results in JSON format.
func (*JSON) Output ¶ added in v0.22.0
func (j *JSON) Output(results []CheckResult) error
Output outputs the results.
type JUnit ¶ added in v0.22.0
JUnit represents an Outputter that outputs results in JUnit format.
func (*JUnit) Output ¶ added in v0.22.0
func (j *JUnit) Output(results []CheckResult) error
Output outputs the results.
type Options ¶ added in v0.22.0
type Options struct { Tracing bool NoColor bool SuppressExceptions bool ShowSkipped bool JUnitHideMessage bool File *os.File }
Options represents the options available when configuring an Outputter.
type Outputter ¶ added in v0.22.0
Outputter controls how results of an evaluation will be recorded and reported to the end user.
type QueryResult ¶ added in v0.22.0
type QueryResult struct { // Query is the fully qualified query that was used // to determine the result. Ex: (data.main.deny) Query string `json:"query"` // Results are the individual results of the query. // When querying data.main.deny, multiple deny rules can // exist, producing multiple results. Results []Result `json:"results"` // Traces represents a single trace of how the query was // evaluated. Each trace value is a trace line. Traces []string `json:"traces"` // Output represents anything print()'ed during the query // evaluation. Each value is a print() call's result. Outputs []string `json:"outputs,omitempty"` }
QueryResult describes the result of evaluting a query.
func (QueryResult) Passed ¶ added in v0.22.0
func (q QueryResult) Passed() bool
Passed returns true if all of the results in the query passed and no failures were found.
type Result ¶
type Result struct { Message string `json:"msg"` Metadata map[string]interface{} `json:"metadata,omitempty"` Outputs []string `json:"outputs,omitempty"` }
Result describes the result of a single rule evaluation.
type Standard ¶ added in v0.22.0
type Standard struct { Writer io.Writer // Tracing will render the trace results of the // queries when set to true. Tracing bool // NoColor will disable all coloring when // set to true. NoColor bool // SuppressExceptions will disable output for exceptions when set to true. SuppressExceptions bool // ShowSkipped whether to show skipped tests // in the output. ShowSkipped bool }
Standard represents an Outputter that outputs results in a human readable format.
func NewStandard ¶ added in v0.22.0
NewStandard creates a new Standard with the given writer.
func (*Standard) Output ¶ added in v0.22.0
func (s *Standard) Output(results []CheckResult) error
Output outputs the results.
type TAP ¶ added in v0.22.0
TAP represents an Outputter that outputs results in TAP format.
func (*TAP) Output ¶ added in v0.22.0
func (t *TAP) Output(checkResults []CheckResult) error
Output outputs the results.
type Table ¶ added in v0.22.0
Table represents an Outputter that outputs results in a tabular format.
func (*Table) Output ¶ added in v0.22.0
func (t *Table) Output(checkResults []CheckResult) error
Output outputs the results.