scripts: Always use tty mode for shellcheck

Even on version 0.7.0, the diff mode throws up a bunch of errors
that don't appear in the tty mode. We'll have to deal with those
at a later date.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ic7001b9cf793e696bbf4bab0b0630e8d705a6905
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4071
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2020-09-04 15:49:42 -07:00 committed by Tomasz Zawadzki
parent 726ac67c55
commit 0ee7697e4d

View File

@ -424,12 +424,8 @@ if hash shellcheck 2> /dev/null; then
SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1083,SC1090,SC1091,SC2010,SC2015,SC2016,SC2034,SC2046,SC2086,\ SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1083,SC1090,SC1091,SC2010,SC2015,SC2016,SC2034,SC2046,SC2086,\
SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223" SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223"
SHCK_FORMAT="diff" SHCK_FORMAT="tty"
SHCK_APPLY=true SHCK_APPLY=false
if [ "$shellcheck_v" \< "0.7.0" ]; then
SHCK_FORMAT="tty"
SHCK_APPLY=false
fi
SHCH_ARGS=" -x -e $SHCK_EXCLUDE -f $SHCK_FORMAT" SHCH_ARGS=" -x -e $SHCK_EXCLUDE -f $SHCK_FORMAT"
error=0 error=0
@ -437,14 +433,6 @@ SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223"
if [ $error -ne 0 ]; then if [ $error -ne 0 ]; then
echo " Bash formatting errors detected!" echo " Bash formatting errors detected!"
# Some errors are not auto-fixable. Fall back to tty output.
if grep -q "Use another format to see them." shellcheck.log; then
SHCK_FORMAT="tty"
SHCK_APPLY=false
SHCH_ARGS=" -e $SHCK_EXCLUDE -f $SHCK_FORMAT"
git ls-files '*.sh' | xargs -P$(nproc) -n1 shellcheck $SHCH_ARGS > shellcheck.log || error=1
fi
cat shellcheck.log cat shellcheck.log
if $SHCK_APPLY; then if $SHCK_APPLY; then
git apply shellcheck.log git apply shellcheck.log