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

Method SetAttestationSyntaxCheckFromError

internal/output/output.go:167–189  ·  view source on GitHub ↗

SetAttestationSyntaxCheck sets the passed and result.message fields of the AttestationSyntaxCheck to the given values.

(err error)

Source from the content-addressed store, hash-verified

165
166// SetAttestationSyntaxCheck sets the passed and result.message fields of the AttestationSyntaxCheck to the given values.
167func (o *Output) SetAttestationSyntaxCheckFromError(err error) {
168 metadata := map[string]interface{}{
169 "code": "builtin.attestation.syntax_check",
170 "title": "Attestation syntax check passed",
171 "description": "The attestation has correct syntax.",
172 }
173 var message string
174
175 if err == nil {
176 o.AttestationSyntaxCheck.Passed = true
177 message = "Pass"
178 log.Debug("Attestation syntax check passed")
179 } else {
180 o.AttestationSyntaxCheck.Passed = false
181 message = fmt.Sprintf("Attestation syntax check failed: %s", err)
182 log.Debug(message)
183 }
184 result := &evaluator.Result{Message: message, Metadata: metadata}
185 if !o.Detailed {
186 keepSomeMetadataSingle(*result)
187 }
188 o.AttestationSyntaxCheck.Result = result
189}
190
191// SetPolicyCheck sets the PolicyCheck and ExitCode to the results and exit code of the Results
192func (o *Output) SetPolicyCheck(results []evaluator.Outcome) {

Callers 2

ValidateImageFunction · 0.95

Calls 1

keepSomeMetadataSingleFunction · 0.85

Tested by 1