From ec632be24f3c54976ba0135ba5b5ffcecc7bce7b Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 15 Apr 2021 14:02:05 +0200 Subject: [PATCH] check_format: Make use of shellcheck's -x conditional -x is supported since 0.4.0 release, make a note of that. Signed-off-by: Michal Berger Change-Id: Icc64132536c18108029f6c5fa2cbdd5b27018d8b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7417 Reviewed-by: Thanos Makatos Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- scripts/check_format.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index aace77a09..67343a8cd 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash readonly BASEDIR=$(readlink -f $(dirname $0))/.. +source "$BASEDIR/scripts/common.sh" + cd $BASEDIR # exit on errors @@ -492,7 +494,13 @@ SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223" SHCK_FORMAT="tty" SHCK_APPLY=false - SHCH_ARGS=" -x -e $SHCK_EXCLUDE -f $SHCK_FORMAT" + SHCH_ARGS="-e $SHCK_EXCLUDE -f $SHCK_FORMAT" + + if ge "$shellcheck_v" 0.4.0; then + SHCH_ARGS+=" -x" + else + echo "shellcheck $shellcheck_v detected, recommended >= 0.4.0." + fi get_bash_files | xargs -P$(nproc) -n1 shellcheck $SHCH_ARGS &> shellcheck.log if [[ -s shellcheck.log ]]; then