MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / calculateScore

Function calculateScore

pkg/advisor/optimizer.go:292–311  ·  view source on GitHub ↗

calculateScore computes the optimization score (0-100). Each suggestion reduces the score based on its severity.

(suggestions []Suggestion)

Source from the content-addressed store, hash-verified

290// calculateScore computes the optimization score (0-100).
291// Each suggestion reduces the score based on its severity.
292func calculateScore(suggestions []Suggestion) int {
293 score := 100
294
295 for _, s := range suggestions {
296 switch s.Severity {
297 case SeverityError:
298 score -= 20
299 case SeverityWarning:
300 score -= 10
301 case SeverityInfo:
302 score -= 5
303 }
304 }
305
306 if score < 0 {
307 score = 0
308 }
309
310 return score
311}
312
313// FormatResult produces a human-readable text report from an OptimizationResult.
314func FormatResult(result *OptimizationResult) string {

Callers 2

TestScoreCalculationFunction · 0.85
AnalyzeMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestScoreCalculationFunction · 0.68