in internal/renderers/report_data.go [162:217]
func (rd *ReportData) RecommendationsTable() [][]string {
counter := map[string]int{}
for _, rt := range rd.Recommendations {
for _, r := range rt {
counter[r.RecommendationID] = 0
}
}
for _, r := range rd.Aprl {
counter[r.RecommendationID]++
}
for _, d := range rd.Azqr {
for _, r := range d.Recommendations {
if r.NotCompliant {
counter[r.RecommendationID]++
}
}
}
headers := []string{"Implemented", "Number of Impacted Resources", "Azure Service / Well-Architected", "Recommendation Source",
"Azure Service Category / Well-Architected Area", "Azure Service / Well-Architected Topic", "Resiliency Category", "Recommendation",
"Impact", "Best Practices Guidance", "Read More", "Recommendation Id"}
rows := [][]string{}
for _, rt := range rd.Recommendations {
for _, r := range rt {
implemented := counter[r.RecommendationID] == 0
categoryPart := ""
servicePart := ""
typeParts := strings.Split(r.ResourceType, "/")
categoryPart = typeParts[0]
if len(typeParts) > 1 {
servicePart = typeParts[1]
}
row := []string{
fmt.Sprintf("%t", implemented),
fmt.Sprint(counter[r.RecommendationID]),
"Azure Service",
r.Source,
categoryPart,
servicePart,
string(r.Category),
r.Recommendation,
string(r.Impact),
r.LongDescription,
r.LearnMoreLink[0].Url,
r.RecommendationID,
}
rows = append(rows, row)
}
}
rows = append([][]string{headers}, rows...)
return rows
}