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

Function captureFallbackText

cmd/validate/vsa.go:1432–1450  ·  view source on GitHub ↗

captureFallbackText captures the text output from a fallback report

(fallbackReport *applicationsnapshot.Report, fs afero.Fs)

Source from the content-addressed store, hash-verified

1430
1431// captureFallbackText captures the text output from a fallback report
1432func captureFallbackText(fallbackReport *applicationsnapshot.Report, fs afero.Fs) (string, error) {
1433 formatOpts := format.Options{
1434 ShowSuccesses: fallbackReport.ShowSuccesses,
1435 ShowWarnings: fallbackReport.ShowWarnings,
1436 ShowPolicyDocsLink: fallbackReport.ShowPolicyDocsLink,
1437 }
1438 var fallbackBuf strings.Builder
1439 fallbackWriter := &stringWriter{&fallbackBuf}
1440 fallbackParser := format.NewTargetParser(
1441 applicationsnapshot.Text,
1442 formatOpts,
1443 fallbackWriter,
1444 fs,
1445 )
1446 if err := fallbackReport.WriteAll([]string{outputFormatText}, fallbackParser); err != nil {
1447 return "", err
1448 }
1449 return fallbackBuf.String(), nil
1450}
1451
1452// writeDataToOutput writes data to stdout or a file, adding a newline if needed
1453// This is shared between ComponentResultsDisplay.WriteAll and writeVSAReport

Callers 1

marshalVSAReportTextFunction · 0.85

Calls 3

NewTargetParserFunction · 0.92
WriteAllMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected