treewide: fix shellcheck errors to pass static-tests again - #22654
Open
crasbe wants to merge 3 commits into
Open
treewide: fix shellcheck errors to pass static-tests again#22654crasbe wants to merge 3 commits into
crasbe wants to merge 3 commits into
Conversation
crasbe
commented
Sep 3, 2026
| @@ -1,3 +1,5 @@ | |||
| # shellcheck shell=bash | |||
| ELFFILE="$8" | ||
| PREFIX="$9" | ||
| RIOTBASE="$10" | ||
| RIOTBASE="${10}" |
Contributor
Author
There was a problem hiding this comment.
For numbers >=10, the brackets have to be used, I don't expect any breakage here.
| @@ -1,4 +1,4 @@ | |||
| #/usr/bin/env bash | |||
| #!/usr/bin/env bash | |||
Contributor
Author
There was a problem hiding this comment.
Uncritical change, just fixed the shebang, no testing required.
| cppcheck --std=c99 --enable=style --force --error-exitcode=2 --quiet -j 1 \ | ||
| --template "{file}:{line}: {severity} ({id}): {message}" \ | ||
| --inline-suppr ${DEFAULT_SUPPRESSIONS} ${CPPCHECK_OPTIONS} ${@} \ | ||
| --inline-suppr ${DEFAULT_SUPPRESSIONS} ${CPPCHECK_OPTIONS} "${@}" \ |
Contributor
Author
There was a problem hiding this comment.
Before the change:
buechse@skyleaf:~/RIOTstuff/riot-vanillaschote/RIOT$ docker run --rm --tty --user $(id -u):$(id -g) --platform linux/amd64 -v '/home/buechse/RIOTstuff/riot-vanillaschote/RIOT:/data/riotbuild/riotbase:delegated' -v '/home/buechse/.cargo/registry:/data/riotbuild/.cargo/registry:delegated' -v '/home/buechse/.cargo/git:/data/riotbuild/.cargo/git:delegated' -e 'TZ=Europe/Berlin' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'BUILD_IN_DOCKER=0' -w '/data/riotbuild/riotbase' -e CI_BASE_BRANCH -e GITHUB_RUN_ID=5 '5ebf563ef282' ./dist/tools/cppcheck/check.sh
boards/adafruit-pybadge/board.c:25: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/esp32x/board_common.c:42: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/esp32x/include/periph_conf_common.h:342: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/esp32x/include/periph_conf_common.h:36: error (preprocessorErrorDirective): #error "ESP32x SoC family not supported"
boards/common/kw41z/include/periph_conf_common.h:49: style (badBitmaskCheck): Operator '|' with one operand equal to zero is redundant.
boards/common/native/board_init.c:86: error (unknownMacro): There is an unknown macro here somewhere. Configuration is required. If RIOT_BOARD is a macro then please configure it.
boards/common/native/include/gpio_params.h:25: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/particle-mesh/bootloader.c:43: error (unknownMacro): There is an unknown macro here somewhere. Configuration is required. If ISR_VECTOR is a macro then please configure it.
boards/common/particle-mesh/include/board.h:104: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/silabs/drivers/bc/bc.c:35: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: UART_DEV( ... )
boards/common/slwstk6000b/include/board.h:38: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_ACTIVE( ... )
boards/common/stm32/include/stm32_leds.h:39: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_ACTIVE( ... )
boards/common/stm32/include/stm32_leds.h:52: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_ACTIVE( ... )
After the change:
buechse@skyleaf:~/RIOTstuff/riot-vanillaschote/RIOT$ docker run --rm --tty --user $(id -u):$(id -g) --platform linux/amd64 -v '/home/buechse/RIOTstuff/riot-vanillaschote/RIOT:/data/riotbuild/riotbase:delegated' -v '/home/buechse/.cargo/registry:/data/riotbuild/.cargo/registry:delegated' -v '/home/buechse/.cargo/git:/data/riotbuild/.cargo/git:delegated' -e 'TZ=Europe/Berlin' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'BUILD_IN_DOCKER=0' -w '/data/riotbuild/riotbase' -e CI_BASE_BRANCH -e GITHUB_RUN_ID=5 '5ebf563ef282' ./dist/tools/cppcheck/check.sh
boards/adafruit-pybadge/board.c:25: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/esp32x/board_common.c:42: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/esp32x/include/periph_conf_common.h:342: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/esp32x/include/periph_conf_common.h:36: error (preprocessorErrorDirective): #error "ESP32x SoC family not supported"
boards/common/kw41z/include/periph_conf_common.h:49: style (badBitmaskCheck): Operator '|' with one operand equal to zero is redundant.
boards/common/native/board_init.c:86: error (unknownMacro): There is an unknown macro here somewhere. Configuration is required. If RIOT_BOARD is a macro then please configure it.
boards/common/native/include/gpio_params.h:25: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/particle-mesh/bootloader.c:43: error (unknownMacro): There is an unknown macro here somewhere. Configuration is required. If ISR_VECTOR is a macro then please configure it.
boards/common/particle-mesh/include/board.h:104: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_USED( ... )
boards/common/silabs/drivers/bc/bc.c:35: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: UART_DEV( ... )
boards/common/slwstk6000b/include/board.h:38: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_ACTIVE( ... )
boards/common/stm32/include/stm32_leds.h:39: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_ACTIVE( ... )
boards/common/stm32/include/stm32_leds.h:52: error (syntaxError): failed to evaluate #if condition, undefined function-like macro invocation: IS_ACTIVE( ... )
| --template "{file}:{line}: {severity} ({id}): {message}" \ | ||
| --inline-suppr ${DEFAULT_SUPPRESSIONS} ${CPPCHECK_OPTIONS} ${@} \ | ||
| cppcheck --std=c99 --enable=style --force --error-exitcode=2 --quiet -j 1 \ | ||
| --template="{file}:{line}: {severity} ({id}): {message}" \ |
Contributor
Author
There was a problem hiding this comment.
The static test didn't even work before adding the =:
buechse@skyleaf:~/RIOTstuff/riot-vanillaschote/RIOT$ docker run --rm --tty --user $(id -u):$(id -g) --platform linux/amd64 -v '/home/buechse/RIOTstuff/riot-vanillaschote/RIOT:/data/riotbuild/riotbase:delegated' -v '/home/buechse/.cargo/registry:/data/riotbuild/.cargo/registry:delegated' -v '/home/buechse/.cargo/git:/data/riotbuild/.cargo/git:delegated' -e 'TZ=Europe/Berlin' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'BUILD_IN_DOCKER=0' -w '/data/riotbuild/riotbase' -e CI_BASE_BRANCH -e GITHUB_RUN_ID=5 '5ebf563ef282' ./dist/tools/cppcheck/check.sh
cppcheck: error: unrecognized command line option: "--template".
|
|
||
| echo "/* DO NOT edit this file, your changes will be overwritten and won't take any effect! */" | ||
| echo "/* Generated from CFLAGS: $@ */" | ||
| echo "/* Generated from CFLAGS: $* */" |
Contributor
Author
There was a problem hiding this comment.
Still works as before:
buechse@skyleaf:~/RIOTstuff/riot-vanillaschote/RIOT$ git checkout pr/shellcheck_errors
Switched to branch 'pr/shellcheck_errors'
buechse@skyleaf:~/RIOTstuff/riot-vanillaschote/RIOT$ ./dist/tools/genconfigheader/genconfigheader.sh > pr.txt
buechse@skyleaf:~/RIOTstuff/riot-vanillaschote/RIOT$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
buechse@skyleaf:~/RIOTstuff/riot-vanillaschote/RIOT$ ./dist/tools/genconfigheader/genconfigheader.sh > master.txt
buechse@skyleaf:~/RIOTstuff/riot-vanillaschote/RIOT$ diff master.txt pr.txt
| ### wait for all flasher processes to finish | ||
| echo Waiting until all devices have been programmed... | ||
| for pid in "${pids}"; do | ||
| for pid in ${pids}; do |
Contributor
Author
There was a problem hiding this comment.
I can't test this, but previously only one element would've been iterated as in this case, the word splitting would be intended.
17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
This PR fixes the errors detected by shellcheck. This does not cover warnings, which remain plenty.
The reason is that fixing warnings can cause a lot of breakage and I'd instead like to get our static tests to pass again.
Testing procedure
I'll provide explicit test traces where possible in review comments later on.
The following errors were present before:
Now no errors remain, just warnings (and plenty thereof...):
Issues/PRs references
Progress for tracking issue #22216
Declaration of AI-Tools / LLMs usage:
AI-Tools / LLMs that were used are: