MCPcopy Create free account
hub / github.com/conforma/cli / SetPolicyCheck

Method SetPolicyCheck

internal/output/output.go:192–211  ·  view source on GitHub ↗

SetPolicyCheck sets the PolicyCheck and ExitCode to the results and exit code of the Results

(results []evaluator.Outcome)

Source from the content-addressed store, hash-verified

190
191// SetPolicyCheck sets the PolicyCheck and ExitCode to the results and exit code of the Results
192func (o *Output) SetPolicyCheck(results []evaluator.Outcome) {
193 for r := range results {
194 if results[r].FileName == "-" {
195 results[r].FileName = ""
196 }
197
198 if !o.Detailed {
199 keepSomeMetadata(results[r].Exceptions)
200 keepSomeMetadata(results[r].Failures)
201 keepSomeMetadata(results[r].Successes)
202 keepSomeMetadata(results[r].Skipped)
203 keepSomeMetadata(results[r].Warnings)
204 }
205
206 if len(results[r].Failures) > 0 {
207 o.ExitCode = 1
208 }
209 }
210 o.PolicyCheck = results
211}
212
213func keepSomeMetadata(results []evaluator.Result) {
214 for i := range results {

Callers 2

ValidateImageFunction · 0.95
ValidateInputFunction · 0.95

Calls 1

keepSomeMetadataFunction · 0.85

Tested by

no test coverage detected