convertVSAReportToFormat converts a VSAReport to the specified format
(report VSAReport, display ComponentResultsDisplay, formatName string, fs afero.Fs)
| 1354 | |
| 1355 | // convertVSAReportToFormat converts a VSAReport to the specified format |
| 1356 | func convertVSAReportToFormat(report VSAReport, display ComponentResultsDisplay, formatName string, fs afero.Fs) ([]byte, error) { |
| 1357 | switch formatName { |
| 1358 | case outputFormatJSON: |
| 1359 | return marshalVSAReportJSON(report) |
| 1360 | case outputFormatYAML: |
| 1361 | return marshalVSAReportYAML(report) |
| 1362 | case outputFormatText: |
| 1363 | return marshalVSAReportText(report, display, fs) |
| 1364 | case outputFormatStatus: |
| 1365 | return marshalVSAReportStatus(report, display) |
| 1366 | default: |
| 1367 | return nil, fmt.Errorf("unsupported format: %s (supported: %s, %s, %s, %s)", formatName, outputFormatJSON, outputFormatYAML, outputFormatText, outputFormatStatus) |
| 1368 | } |
| 1369 | } |
| 1370 | |
| 1371 | // marshalVSAReportJSON converts VSAReport to JSON |
| 1372 | func marshalVSAReportJSON(report VSAReport) ([]byte, error) { |
no test coverage detected