From 9a47ddc1089f6a32fbc37d2c5e96216cd885eb3a Mon Sep 17 00:00:00 2001 From: Leon Zhang Date: Wed, 26 May 2021 19:53:50 +0800 Subject: [PATCH] fix #282 -report-type json wrong score --- advisor/rules.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/advisor/rules.go b/advisor/rules.go index 67e9d77..64a2fe2 100644 --- a/advisor/rules.go +++ b/advisor/rules.go @@ -1516,6 +1516,10 @@ func formatJSON(sql string, db string, suggest map[string]Rule) string { common.Log.Error("formatJSON strconv.Atoi error: %s, item: %s, serverity: %s", err.Error(), item, suggest[item].Severity) } score = score - l*5 + // ## MySQL execute failed + if strings.HasPrefix(item, "ERR") { + score = 0 + } } if score < 0 { score = 0