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

Function generateTextReport

internal/input/report.go:224–259  ·  view source on GitHub ↗
(r *Report)

Source from the content-addressed store, hash-verified

222var efs embed.FS
223
224func generateTextReport(r *Report) ([]byte, error) {
225 // Prepare some template input
226 // Calculate totals for the test report structure
227 var successes, failures, warnings int
228 for _, input := range r.FilePaths {
229 successes += input.SuccessCount
230 failures += len(input.Violations)
231 warnings += len(input.Warnings)
232 }
233
234 result := "SUCCESS"
235 if failures > 0 {
236 result = "FAILURE"
237 } else if warnings > 0 {
238 result = "WARNING"
239 }
240
241 testReport := TestReport{
242 Timestamp: r.created.Format(time.RFC3339),
243 Namespace: "",
244 Successes: successes,
245 Failures: failures,
246 Warnings: warnings,
247 Result: result,
248 }
249
250 input := struct {
251 Report *Report
252 TestReport TestReport
253 }{
254 Report: r,
255 TestReport: testReport,
256 }
257
258 return utils.RenderFromTemplatesWithMain(input, "text_report.tmpl", efs)
259}

Callers 1

toFormatMethod · 0.70

Calls 1

Tested by

no test coverage detected