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

Function convertVSAReportToFormat

cmd/validate/vsa.go:1356–1369  ·  view source on GitHub ↗

convertVSAReportToFormat converts a VSAReport to the specified format

(report VSAReport, display ComponentResultsDisplay, formatName string, fs afero.Fs)

Source from the content-addressed store, hash-verified

1354
1355// convertVSAReportToFormat converts a VSAReport to the specified format
1356func 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
1372func marshalVSAReportJSON(report VSAReport) ([]byte, error) {

Callers 1

writeVSAReportFunction · 0.85

Calls 5

marshalVSAReportJSONFunction · 0.85
marshalVSAReportYAMLFunction · 0.85
marshalVSAReportTextFunction · 0.85
marshalVSAReportStatusFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected