Commit 0ee7697e authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

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: default avatarBen Walker <benjamin.walker@intel.com>
Change-Id: Ic7001b9cf793e696bbf4bab0b0630e8d705a6905
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4071


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 726ac67c
Loading
Loading
Loading
Loading
+2 −14
Original line number Diff line number Diff line
@@ -424,12 +424,8 @@ if hash shellcheck 2> /dev/null; then
	SHCK_EXCLUDE="$SHCK_EXCLUDE,SC1083,SC1090,SC1091,SC2010,SC2015,SC2016,SC2034,SC2046,SC2086,\
SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223"

	SHCK_FORMAT="diff"
	SHCK_APPLY=true
	if [ "$shellcheck_v" \< "0.7.0" ]; then
	SHCK_FORMAT="tty"
	SHCK_APPLY=false
	fi
	SHCH_ARGS=" -x -e $SHCK_EXCLUDE -f $SHCK_FORMAT"

	error=0
@@ -437,14 +433,6 @@ SC2119,SC2120,SC2148,SC2153,SC2154,SC2164,SC2174,SC2001,SC2206,SC2207,SC2223"
	if [ $error -ne 0 ]; then
		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
		if $SHCK_APPLY; then
			git apply shellcheck.log