(comparison *BenchmarkComparison, verdict BenchmarkVerdict, run BenchmarkRun, pluginRules map[string][]PluginSLA)
| 178 | } |
| 179 | |
| 180 | func (BenchmarkCore) BuildBenchmarkReport(comparison *BenchmarkComparison, verdict BenchmarkVerdict, run BenchmarkRun, pluginRules map[string][]PluginSLA) BenchmarkReport { |
| 181 | if pluginRules == nil { |
| 182 | pluginRules = map[string][]PluginSLA{} |
| 183 | } |
| 184 | overview := buildOverviewLines(verdict, run, comparison) |
| 185 | var sections []PluginSection |
| 186 | for _, pluginName := range runPluginNames(run) { |
| 187 | result := run.PluginResults[pluginName] |
| 188 | deltaMetrics := map[string]any{} |
| 189 | if comparison != nil { |
| 190 | if found := comparison.MetricDeltas[pluginName]; found != nil { |
| 191 | deltaMetrics = found |
| 192 | } |
| 193 | } |
| 194 | failures := append([]FailureRecord{}, result.FailureRecords...) |
| 195 | for _, record := range verdict.FailureRecords { |
| 196 | if record.Plugin == pluginName { |
| 197 | failures = append(failures, record) |
| 198 | } |
| 199 | } |
| 200 | sections = append(sections, PluginSection{ |
| 201 | Plugin: pluginName, |
| 202 | Scorecard: result.Scorecard, |
| 203 | ProcessMetrics: result.ProcessMetrics, |
| 204 | FailureRecords: failures, |
| 205 | SLARules: pluginRules[pluginName], |
| 206 | BenefitDirection: mapToBenefitLines(deltaMetrics), |
| 207 | }) |
| 208 | } |
| 209 | notes := buildNoteLines(verdict, comparison) |
| 210 | markdown := renderMarkdown(overview, sections, verdict, notes) |
| 211 | var deltaRecords []MetricDelta |
| 212 | if comparison != nil { |
| 213 | deltaRecords = comparison.DeltaRecords |
| 214 | } |
| 215 | return BenchmarkReport{ |
| 216 | Passed: verdict.Passed, |
| 217 | Markdown: markdown, |
| 218 | Overview: overview, |
| 219 | PluginSections: sections, |
| 220 | FailureRecords: verdict.FailureRecords, |
| 221 | Warnings: verdict.Warnings, |
| 222 | DeltaRecords: deltaRecords, |
| 223 | Notes: notes, |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | func satisfies(value any, operator string, threshold float64) (bool, error) { |
| 228 | numeric, ok := numericValue(value) |
no test coverage detected