Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions internal/report/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,37 @@ const htmlTemplate = `<!DOCTYPE html>
{{end}}
</section>

{{if .CountViolations}}
<section class="section">
<h2>Count Rule Violations <span class="badge" style="background: #6c757d; color: white;">{{len .CountViolations}}</span></h2>
{{range .CountViolations}}
<div class="violation-card {{.ImpactCSS}}">
<div class="violation-header">
<div>
<strong>{{.RuleID}}</strong>
<span style="margin-left: 10px; color: #6c757d;">{{.Description}}</span>
</div>
<span class="impact-badge {{.ImpactCSS}}">{{.Impact}}</span>
</div>
<div class="violation-body">
<p><strong>Count:</strong> {{.Count}} CRs matched</p>
<p><strong>Comment:</strong> {{.Comment}}</p>
{{if .MatchedCRs}}
<div class="matched-crs">
<h5>Matched CRs:</h5>
<ul>
{{range .MatchedCRs}}
<li>{{.}}</li>
{{end}}
</ul>
</div>
{{end}}
</div>
</div>
{{end}}
</section>
{{end}}

<section class="section">
<h2>Detected Differences <span class="badge" style="background: #6c757d; color: white;">{{len .Diffs}}</span></h2>
{{if .Diffs}}
Expand Down Expand Up @@ -1659,37 +1690,6 @@ const htmlTemplate = `<!DOCTYPE html>
{{end}}
</section>

{{if .CountViolations}}
<section class="section">
<h2>Count Rule Violations <span class="badge" style="background: #6c757d; color: white;">{{len .CountViolations}}</span></h2>
{{range .CountViolations}}
<div class="violation-card {{.ImpactCSS}}">
<div class="violation-header">
<div>
<strong>{{.RuleID}}</strong>
<span style="margin-left: 10px; color: #6c757d;">{{.Description}}</span>
</div>
<span class="impact-badge {{.ImpactCSS}}">{{.Impact}}</span>
</div>
<div class="violation-body">
<p><strong>Count:</strong> {{.Count}} CRs matched</p>
<p><strong>Comment:</strong> {{.Comment}}</p>
{{if .MatchedCRs}}
<div class="matched-crs">
<h5>Matched CRs:</h5>
<ul>
{{range .MatchedCRs}}
<li>{{.}}</li>
{{end}}
</ul>
</div>
{{end}}
</div>
</div>
{{end}}
</section>
{{end}}

<footer style="text-align: center; padding: 20px; color: #6c757d; font-size: 0.85rem;">
Generated using <a href="https://github.com/openshift-kni/rds-analyzer">RDS Analyzer</a>
</footer>
Expand Down
20 changes: 10 additions & 10 deletions internal/report/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ type evaluatedDiff struct {

// printDiffs outputs the configuration differences section.
func (g *TextGenerator) printDiffs(diffs []types.Diff) {
fmt.Fprintln(g.writer, "==================================================")
fmt.Fprintln(g.writer, " DETECTED DIFFERENCES")
fmt.Fprintln(g.writer, "==================================================")

if len(diffs) == 0 {
fmt.Fprintln(g.writer, "No differences detected.")
return
Expand Down Expand Up @@ -215,6 +211,16 @@ func (g *TextGenerator) printDiffs(diffs []types.Diff) {
return getImpactPriority(evaluatedDiffs[i].finalImpact) < getImpactPriority(evaluatedDiffs[j].finalImpact)
})

// Evaluate and print count rule violations.
countResults := g.ruleEngine.EvaluateCountRules(allDiffChecks)
if len(countResults) > 0 {
g.printCountRuleResults(countResults, impactStats)
}

fmt.Fprintln(g.writer, "==================================================")
fmt.Fprintln(g.writer, " DETECTED DIFFERENCES")
fmt.Fprintln(g.writer, "==================================================")

// Print sorted diffs.
for diffIndex, ed := range evaluatedDiffs {
fmt.Fprintf(g.writer, "--- Diff %d of %d ---\n", diffIndex+1, len(evaluatedDiffs))
Expand All @@ -233,12 +239,6 @@ func (g *TextGenerator) printDiffs(diffs []types.Diff) {
fmt.Fprintln(g.writer)
}

// Evaluate and print count rule violations.
countResults := g.ruleEngine.EvaluateCountRules(allDiffChecks)
if len(countResults) > 0 {
g.printCountRuleResults(countResults, impactStats)
}

// Print summary statistics.
fmt.Fprintln(g.writer, "==================================================")
fmt.Fprintln(g.writer, " IMPACT SUMMARY")
Expand Down
Loading