From 8b4a93f53cabc271269dcecbe073cfc0ab38d010 Mon Sep 17 00:00:00 2001 From: zjc_he Date: Tue, 28 May 2024 19:48:48 +0800 Subject: [PATCH] feat(conf.toml,-expected.json): cppcheck sillycode example --- conf.toml | 11 +++++------ expected.json | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/conf.toml b/conf.toml index 47bdd8b..beaaf40 100644 --- a/conf.toml +++ b/conf.toml @@ -1,10 +1,10 @@ skipGitea = true [[stages]] -name = "clangtidy" +name = "cppcheck" [stages.executor] name = "sandbox" [stages.executor.with.default] -args = ["cppcheck --template='{\"file\":\"{file}\",\"line\":{line}, \"column\":{column}, \"severity\":\"{severity}\", \"message\":\"{message}\", \"id\":\"{id}\"},' --force --enable=all --quiet src/*.cpp"] +args = ["bash","-c","cppcheck --template='{\"file\":\"{file}\",\"line\":{line}, \"column\":{column}, \"severity\":\"{severity}\", \"message\":\"{message}\", \"id\":\"{id}\"}' --force --enable=all --quiet src/*.cpp"] env = ["PATH=/usr/bin:/bin:/usr/local/bin"] cpuLimit = 10_000_000_000 memoryLimit = 419_430_400 @@ -23,13 +23,12 @@ max = 65_536 name = "cppcheck" [stages.parser.with] score = 100 -rootdir = "/w" [[stages.parser.with.matches]] -keyword = ["cppcoreguidelines-avoid-non-const-global-variables"] +severity = ["error"] score = 5 [[stages.parser.with.matches]] -keyword = ["readability-identifier-length","misc-use-anonymous-namespace"] +severity = ["warning"] score = 2 [[stages.parser.with.matches]] -keyword = ["llvmlibc-implementation-in-namespace"] +severity = ["probability", "performance", "style"] score = 1 diff --git a/expected.json b/expected.json index 48028ed..b3f582f 100644 --- a/expected.json +++ b/expected.json @@ -1 +1 @@ -[{"name":"clangtidy","results":[{"score":-185,"comment":"### Test results summary\n\n1. codequality-unchecked-malloc-result: 0\n2. codequality-no-global-variables: 0\n3. codequality-no-header-guard: 0\n4. codequality-no-fflush-stdin: 0\n5. readability-function-size: 0\n6. readability-duplicate-include: 0\n7. readability-identifier-naming: 0\n8. readability-redundant: 0\n9. readability-misleading-indentation: 0\n10. readability-misplaced-array-index: 0\n11. cppcoreguidelines-init-variables: 0\n12. bugprone-suspicious-string-compare: 0\n13. google-global-names-in-headers: 0\n14. clang-diagnostic: 1\n15. clang-analyzer: 0\n16. misc: 9\n17. performance: 5\n18. others: 185\n"}]}] +[{"name":"cppcheck","results":[{"score":95,"comment":"### Test results summary\n\n1. error: 1\n2. warning: 0\n3. probability: 0\n4. performance: 0\n5. style: 0\n6. information: 4"}]}]