From bbbfc57f63c0137139ec718d809f7ba590f8d14b Mon Sep 17 00:00:00 2001 From: eduazocar Date: Wed, 22 Mar 2023 01:57:50 -0400 Subject: [PATCH 1/2] dist/tools: cppcheck setup for running locally --- dist/tools/cppcheck/check.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dist/tools/cppcheck/check.sh b/dist/tools/cppcheck/check.sh index 8ce836c24..3b4b6371e 100755 --- a/dist/tools/cppcheck/check.sh +++ b/dist/tools/cppcheck/check.sh @@ -8,7 +8,7 @@ # General Public License v2.1. See the file LICENSE in the top level # directory for more details. -: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}" +: "${RIOTBASE:="$(cd "$(dirname "$0")/../../../" || exit ; pwd)"}" cd $RIOTBASE : "${RIOTTOOLS:=${RIOTBASE}/dist/tools}" @@ -24,7 +24,17 @@ else DEFAULT_SUPPRESSIONS=--suppress="unusedStructMember" fi -FILES="" +# These new changes allows process locally cppcheck tests. +CODE_FOLDERS="${RIOTBASE}/firmware/ \ + ${RIOTBASE}/boards/ \ + ${RIOTBASE}/examples/ \ + ${RIOTBASE}/tests/ \ + ${RIOTBASE}/wifi-subsys/"\ + +# If you want to check only with changed files +# change this file with +# FILES="" +FILES="${CODE_FOLDERS}" CPPCHECK_OPTIONS="" IN_FILES_SECTION=false while [ $# -gt 0 ]; do From 7e1512a1af92e474eced8635ae4e3e1e9c058cd6 Mon Sep 17 00:00:00 2001 From: eduazocar Date: Wed, 22 Mar 2023 02:07:43 -0400 Subject: [PATCH 2/2] wifi-subsys: Fixed cppcheck static errors Presented --- wifi-subsys/components/uart/src/at_handler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wifi-subsys/components/uart/src/at_handler.c b/wifi-subsys/components/uart/src/at_handler.c index a4fd73b87..04ac94999 100644 --- a/wifi-subsys/components/uart/src/at_handler.c +++ b/wifi-subsys/components/uart/src/at_handler.c @@ -50,6 +50,8 @@ char *symbols[4] = { "=", }; +/* cppcheck-suppress constParameter + * (reason: ) */ int get_symbol(char *command, size_t len, char *output) { for (size_t i = 0; i < len; i++) { for (size_t j = 0; j < 4; j++) { @@ -103,7 +105,7 @@ esp_err_t parse_at_message(uint8_t *at_command, at_request_t *output) { key2 = strtok(NULL, "+"); } - /* cppcheck-suppress nullPointerRedundantCheck + /* cppcheck-suppress nullPointer * (reason: ) */ memcpy(output->key, key_value, strlen(key_value) + 1); if (value != NULL) {