MCPcopy Index your code
hub / github.com/github/gh-aw / renderAuditDiffJSON

Function renderAuditDiffJSON

pkg/cli/audit_diff_render.go:20–31  ·  view source on GitHub ↗

renderAuditDiffJSON outputs audit diffs as JSON to stdout. When a single diff is provided, outputs a JSON object for backward compatibility. When multiple diffs are provided, outputs a JSON array.

(diffs []*AuditDiff)

Source from the content-addressed store, hash-verified

18// When a single diff is provided, outputs a JSON object for backward compatibility.
19// When multiple diffs are provided, outputs a JSON array.
20func renderAuditDiffJSON(diffs []*AuditDiff) error {
21 auditDiffRenderLog.Printf("Rendering %d audit diff(s) as JSON", len(diffs))
22 if len(diffs) == 0 {
23 return errors.New("no diffs to render")
24 }
25 encoder := json.NewEncoder(os.Stdout)
26 encoder.SetIndent("", " ")
27 if len(diffs) == 1 {
28 return encoder.Encode(diffs[0])
29 }
30 return encoder.Encode(diffs)
31}
32
33// renderAuditDiffMarkdown outputs audit diffs as markdown to stdout.
34// Multiple diffs are separated by a horizontal rule.

Callers 1

RunAuditDiffFunction · 0.85

Calls 1

PrintfMethod · 0.45

Tested by

no test coverage detected