Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist/tools: cppcheck fixes static errors & local running #382

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions dist/tools/cppcheck/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion wifi-subsys/components/uart/src/at_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ char *symbols[4] = {
"=",
};

/* cppcheck-suppress constParameter
* (reason: <is necessary verify that this data is not null>) */
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++) {
Expand Down Expand Up @@ -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: <is necessary verify that this data is not null>) */
memcpy(output->key, key_value, strlen(key_value) + 1);
if (value != NULL) {
Expand Down