|
1 | 1 | package narrative |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "fmt" |
5 | | - |
6 | 4 | "github.com/varax/operator/pkg/evidence" |
7 | 5 | "github.com/varax/operator/pkg/models" |
8 | 6 | ) |
@@ -71,45 +69,6 @@ func buildForControl(cr models.ControlResult, items []evidence.EvidenceItem) Con |
71 | 69 | } |
72 | 70 | } |
73 | 71 |
|
74 | | -// buildMinimal creates a simple narrative for controls with thin scan coverage. |
75 | | -func buildMinimal(cr models.ControlResult, focus string) ControlNarrative { |
76 | | - passCount, failCount := countCheckStatus(cr) |
77 | | - status := statusLabel(passCount, failCount) |
78 | | - |
79 | | - summary := fmt.Sprintf( |
80 | | - "This cluster was assessed for %s. %s %s mapped to this control, with %s.", |
81 | | - focus, |
82 | | - pluralize(len(cr.CheckResults), "check", "checks"), |
83 | | - verbAgreement(len(cr.CheckResults)), |
84 | | - countByStatus(passCount, failCount), |
85 | | - ) |
86 | | - |
87 | | - var findingsText string |
88 | | - if failCount > 0 { |
89 | | - findings := extractFindings(cr) |
90 | | - if len(findings) > 0 { |
91 | | - lines := make([]string, len(findings)) |
92 | | - for i, f := range findings { |
93 | | - lines[i] = fmt.Sprintf("%s: %s", f.CheckID, f.Message) |
94 | | - } |
95 | | - findingsText = "Findings requiring attention: " + joinList(lines) + "." |
96 | | - } |
97 | | - } |
98 | | - |
99 | | - assessment := fmt.Sprintf("Assessment: %s — %s.", status, countByStatus(passCount, failCount)) |
100 | | - |
101 | | - if findingsText != "" { |
102 | | - return MinimalNarrative{ |
103 | | - Summary: summary + " " + findingsText, |
104 | | - Assessment: assessment, |
105 | | - } |
106 | | - } |
107 | | - return MinimalNarrative{ |
108 | | - Summary: summary, |
109 | | - Assessment: assessment, |
110 | | - } |
111 | | -} |
112 | | - |
113 | 72 | // countCheckStatus counts passing and failing checks in a control result. |
114 | 73 | func countCheckStatus(cr models.ControlResult) (pass, fail int) { |
115 | 74 | for _, c := range cr.CheckResults { |
|
0 commit comments