SetPolicyCheck sets the PolicyCheck and ExitCode to the results and exit code of the Results
(results []evaluator.Outcome)
| 190 | |
| 191 | // SetPolicyCheck sets the PolicyCheck and ExitCode to the results and exit code of the Results |
| 192 | func (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 | |
| 213 | func keepSomeMetadata(results []evaluator.Result) { |
| 214 | for i := range results { |
no test coverage detected