func()

in coverage/report.go [63:124]


func (c *CoverageReport) MarkdownContent() string {
	template := `
### Coverage Status:

#### Summary

${coverage_summary}

#### Details

${coverage_details}
`

	fullyCoveredPath := make([]string, 0)
	partiallyCoveredPath := make([]string, 0)
	for _, v := range c.Coverages {
		if v.Model.IsFullyCovered {
			fullyCoveredPath = append(fullyCoveredPath, v.DisplayName)
		} else {
			partiallyCoveredPath = append(partiallyCoveredPath, fmt.Sprintf("%v (%v/%v)", v.DisplayName, v.Model.RootCoveredCount, v.Model.RootTotalCount))
		}
	}

	summary := ""
	if len(fullyCoveredPath) > 0 {
		summary += fmt.Sprintf("Congratulations! The following resource types are 100%% covered:\n\n- %s\n\n", strings.Join(fullyCoveredPath, "\n- "))
	}
	if len(partiallyCoveredPath) > 0 {
		summary += fmt.Sprintf("The following resource types are partially covered, please help add more test cases:\n\n- %s\n\n", strings.Join(partiallyCoveredPath, "\n- "))
	}

	content := strings.ReplaceAll(template, "${coverage_summary}", summary)

	var coverages []string
	count := 0
	for _, v := range c.Coverages {
		count++

		reportDetail := getReport(v.Model.ModelName, v.Model)
		sort.Strings(reportDetail)

		coverages = append(coverages, fmt.Sprintf(`##### <!-- %[1]v -->
<details open>
<summary>%[1]v  %[2]v</summary>

[swagger](%[3]v)
<blockquote>

%[4]v

</blockquote>
</details>

---
`, v.DisplayName, v.ApiPath, v.Model.SourceFile, strings.Join(reportDetail, "\n\n")))
	}

	sort.Strings(coverages)
	content = strings.ReplaceAll(content, "${coverage_details}", strings.Join(coverages, "\n"))

	return content
}