MCPcopy
hub / github.com/kubernetes/test-infra / ContentForGitHubPost

Function ContentForGitHubPost

robots/coverage/diff/view.go:64–85  ·  view source on GitHub ↗

ContentForGitHubPost constructs the message covbot posts

(baseProfiles, newProfiles []*cover.Profile, jobName string, coverageThreshold float32)

Source from the content-addressed store, hash-verified

62
63// ContentForGitHubPost constructs the message covbot posts
64func ContentForGitHubPost(baseProfiles, newProfiles []*cover.Profile, jobName string, coverageThreshold float32) (
65 string, bool) {
66
67 rows := []string{
68 "The following is the code coverage report",
69 fmt.Sprintf("Say `/test %s` to re-run this coverage report", jobName),
70 "",
71 "File | Old Coverage | New Coverage | Delta",
72 "---- |:------------:|:------------:|:-----:",
73 }
74
75 table, isCoverageLow := makeTable(calculation.ProduceCovList(baseProfiles), calculation.ProduceCovList(newProfiles), coverageThreshold)
76
77 if table == "" {
78 return "", false
79 }
80
81 rows = append(rows, table)
82 rows = append(rows, "")
83
84 return strings.Join(rows, "\n"), isCoverageLow
85}

Callers 1

runFunction · 0.92

Calls 2

ProduceCovListFunction · 0.92
makeTableFunction · 0.85

Tested by

no test coverage detected