From 15a6800685b956bf7e25a2c495d26dafb94db135 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Fri, 4 Oct 2024 06:52:06 -0400 Subject: [PATCH] fix: typo in cppcheck parser --- examples/cppcheck/sillycode | 2 +- examples/healthcheck/asciifile | 2 +- examples/healthcheck/asciimsg | 2 +- examples/healthcheck/forbiddenfile | 2 +- examples/healthcheck/meta | 2 +- examples/healthcheck/reposize | 2 +- examples/healthcheck/repoverify | 2 +- internal/parsers/cppcheck/score.go | 18 +++++++++++------- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/examples/cppcheck/sillycode b/examples/cppcheck/sillycode index 866e732..fccb1bc 160000 --- a/examples/cppcheck/sillycode +++ b/examples/cppcheck/sillycode @@ -1 +1 @@ -Subproject commit 866e73258c2d8f87b0000754a16f9b9c7de0c0fa +Subproject commit fccb1bc04ccd0df5f3855dbf73a142f876eab94e diff --git a/examples/healthcheck/asciifile b/examples/healthcheck/asciifile index 146b2f8..6d82a13 160000 --- a/examples/healthcheck/asciifile +++ b/examples/healthcheck/asciifile @@ -1 +1 @@ -Subproject commit 146b2f829a91594c89f1d1379d312b91c5f97a55 +Subproject commit 6d82a1344fbbd994e8c63428e5c1759bd7ef4f6f diff --git a/examples/healthcheck/asciimsg b/examples/healthcheck/asciimsg index ffd9ab1..1e1d152 160000 --- a/examples/healthcheck/asciimsg +++ b/examples/healthcheck/asciimsg @@ -1 +1 @@ -Subproject commit ffd9ab13c7e403d0afc7f1dfc86ec131f9992498 +Subproject commit 1e1d15265956703a14efb52a1aef82f2fecee46b diff --git a/examples/healthcheck/forbiddenfile b/examples/healthcheck/forbiddenfile index b93a025..a384a00 160000 --- a/examples/healthcheck/forbiddenfile +++ b/examples/healthcheck/forbiddenfile @@ -1 +1 @@ -Subproject commit b93a0254c2842e4d9c3a4b8f832cd6b17bf284f9 +Subproject commit a384a00736523d674851b6a58b383487b7328144 diff --git a/examples/healthcheck/meta b/examples/healthcheck/meta index b469371..c7c905e 160000 --- a/examples/healthcheck/meta +++ b/examples/healthcheck/meta @@ -1 +1 @@ -Subproject commit b4693716ee97bd5d9814c512b036aabeb12c7fd6 +Subproject commit c7c905ebcfad171e0edba0485358744c49aad6e2 diff --git a/examples/healthcheck/reposize b/examples/healthcheck/reposize index 9c010a0..adb9a3b 160000 --- a/examples/healthcheck/reposize +++ b/examples/healthcheck/reposize @@ -1 +1 @@ -Subproject commit 9c010a0f8d501223f94d677a4aed70f0162092e2 +Subproject commit adb9a3b5922274725801b5c18e42aafca7540ec1 diff --git a/examples/healthcheck/repoverify b/examples/healthcheck/repoverify index 99d95c2..dd11177 160000 --- a/examples/healthcheck/repoverify +++ b/examples/healthcheck/repoverify @@ -1 +1 @@ -Subproject commit 99d95c2841517f36a2063c641ea2e1b9b6190c76 +Subproject commit dd11177f3c3cf21728a84d808595de887fe4807a diff --git a/internal/parsers/cppcheck/score.go b/internal/parsers/cppcheck/score.go index dbdf81e..5c0bcd4 100644 --- a/internal/parsers/cppcheck/score.go +++ b/internal/parsers/cppcheck/score.go @@ -7,10 +7,11 @@ type Severity int const ( ERROR Severity = iota WARNING - PROBABILITY + PORTABILITY PERFORMANCE STYLE INFORMATION + DEBUG UNKNOWN ) @@ -20,14 +21,16 @@ func severityFromString(severityString string) (Severity, error) { return ERROR, nil case "warning": return WARNING, nil - case "probability": - return PROBABILITY, nil + case "portability": + return PORTABILITY, nil case "performance": return PERFORMANCE, nil case "style": return STYLE, nil case "information": return INFORMATION, nil + case "debug": + return DEBUG, nil default: return UNKNOWN, fmt.Errorf("unknown severity type \"%s\" for cppcheck", severityString) } @@ -35,8 +38,8 @@ func severityFromString(severityString string) (Severity, error) { func GetResult(records []Record, conf Conf) (string, int, error) { result := "### Test results summary\n\n" - var severityCounts [6]int - var severityScore [6]int + var severityCounts [UNKNOWN]int + var severityScore [UNKNOWN]int score := conf.Score for _, match := range conf.Matches { @@ -58,9 +61,10 @@ func GetResult(records []Record, conf Conf) (string, int, error) { } result += fmt.Sprintf("1. error: %d\n", severityCounts[0]) result += fmt.Sprintf("2. warning: %d\n", severityCounts[1]) - result += fmt.Sprintf("3. probability: %d\n", severityCounts[2]) + result += fmt.Sprintf("3. portability: %d\n", severityCounts[2]) result += fmt.Sprintf("4. performance: %d\n", severityCounts[3]) result += fmt.Sprintf("5. style: %d\n", severityCounts[4]) - result += fmt.Sprintf("6. information: %d", severityCounts[5]) + result += fmt.Sprintf("6. information: %d\n", severityCounts[5]) + result += fmt.Sprintf("7. debug: %d\n", severityCounts[6]) return result, score, nil }