2019-01-17 12:39:15 +01:00
|
|
|
#!/bin/bash
|
2019-01-24 11:11:08 +01:00
|
|
|
# run-shellcheck
|
|
|
|
# please do not run this script directly but `docker_build_and_run_shellcheck.sh`
|
2019-01-17 12:39:15 +01:00
|
|
|
|
|
|
|
files=""
|
2019-01-24 11:11:08 +01:00
|
|
|
retval=0
|
2019-01-17 12:39:15 +01:00
|
|
|
|
2020-12-10 09:50:33 +01:00
|
|
|
if [ "$#" -eq 0 ]; then
|
2020-12-04 14:08:01 +01:00
|
|
|
files=$(find . -name "*.sh" | sort -V)
|
2019-01-17 12:39:15 +01:00
|
|
|
else
|
|
|
|
files="$*"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for f in $files; do
|
2019-01-24 11:11:08 +01:00
|
|
|
if head "$f" | grep -qE "^# run-shellcheck$"; then
|
|
|
|
printf "\e[1;36mRunning shellcheck on: %s \e[0m\n" "$f"
|
2017-12-20 15:14:30 +01:00
|
|
|
if ! /usr/bin/shellcheck --color=always --shell=bash -e SC1091 "$f"; then
|
2019-01-24 11:11:08 +01:00
|
|
|
retval=$((retval + 1))
|
|
|
|
fi
|
|
|
|
fi
|
2019-01-17 12:39:15 +01:00
|
|
|
done
|
2019-01-24 11:11:08 +01:00
|
|
|
exit "$retval"
|