buildVSAReport creates a VSAReport with optional fallback
(display ComponentResultsDisplay, allData AllSectionsData, data *validateVSAData)
| 1527 | |
| 1528 | // buildVSAReport creates a VSAReport with optional fallback |
| 1529 | func buildVSAReport(display ComponentResultsDisplay, allData AllSectionsData, data *validateVSAData) (VSAReport, error) { |
| 1530 | vsaSections := display.toVSASectionsReport() |
| 1531 | report := VSAReport{ |
| 1532 | Header: vsaSections.Header, |
| 1533 | Result: vsaSections.Result, |
| 1534 | VSASummary: vsaSections.VSASummary, |
| 1535 | PolicyDiff: vsaSections.PolicyDiff, |
| 1536 | Fallback: nil, |
| 1537 | } |
| 1538 | |
| 1539 | if allData.FallbackUsed { |
| 1540 | fallbackReport, err := createFallbackReport(allData, data) |
| 1541 | if err != nil { |
| 1542 | return VSAReport{}, fmt.Errorf("failed to create fallback report: %w", err) |
| 1543 | } |
| 1544 | report.Fallback = fallbackReport |
| 1545 | } |
| 1546 | |
| 1547 | return report, nil |
| 1548 | } |
| 1549 | |
| 1550 | // writeSeparateOutputToStdout writes VSA and fallback results separately to stdout |
| 1551 | func writeSeparateOutputToStdout(display ComponentResultsDisplay, allData AllSectionsData, data *validateVSAData, outputFormats []string, cmd *cobra.Command) error { |
no test coverage detected