scripts/check_format.sh: shellcheck fallback to tty
Fall back to tty output in case diff cannot be used for not auto-fixable errors. Change-Id: I481ad0dbe8e42cf510fa3a02636bc0117630da14 Signed-off-by: Karol Latecki <karol.latecki@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464171 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
2a5ccacaae
commit
1a3e41f281
@ -258,9 +258,18 @@ SC2199,SC2206,SC2207,SC2209,SC2214,SC2219,SC2220,SC2223,SC2230,SC2231,SC2235"
|
|||||||
SHCH_ARGS=" -e $SHCK_EXCLUDE -f $SHCK_FORMAT"
|
SHCH_ARGS=" -e $SHCK_EXCLUDE -f $SHCK_FORMAT"
|
||||||
|
|
||||||
error=0
|
error=0
|
||||||
git ls-files '*.sh' | xargs -P$(nproc) -n1 shellcheck $SHCH_ARGS > shellcheck.log || error=1
|
git ls-files '*.sh' | xargs -P$(nproc) -n1 shellcheck $SHCH_ARGS &> shellcheck.log || error=1
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user