2020-09-28 15:54:35 +00:00
|
|
|
#!/bin/sh -eu
|
2020-05-07 06:59:14 +00:00
|
|
|
|
2020-09-28 15:54:35 +00:00
|
|
|
SHELLCHECKCMD='shellcheck -s sh -f gcc -x'
|
2020-05-07 06:59:14 +00:00
|
|
|
# Skip SC2154 for variables starting with __ since such variables are cdist
|
|
|
|
# environment variables.
|
|
|
|
SHELLCHECK_SKIP=': __.*is referenced but not assigned.*\[SC2154\]'
|
2020-09-28 15:54:35 +00:00
|
|
|
SHELLCHECKTMP='.shellcheck.tmp'
|
2020-05-07 06:59:14 +00:00
|
|
|
|
2020-05-07 07:36:27 +00:00
|
|
|
# Move to top-level cdist-contrib directory.
|
2020-09-28 15:54:35 +00:00
|
|
|
cd "$(dirname $0)"/..
|
2020-05-07 07:36:27 +00:00
|
|
|
|
2020-09-28 15:54:35 +00:00
|
|
|
check() {
|
|
|
|
find type/ -type f "$@" -exec ${SHELLCHECKCMD} {} + \
|
|
|
|
| grep -v "${SHELLCHECK_SKIP}" >>"${SHELLCHECKTMP}" || true
|
2020-05-07 06:59:14 +00:00
|
|
|
}
|
|
|
|
|
2020-09-28 15:54:35 +00:00
|
|
|
rm -f "${SHELLCHECKTMP}"
|
|
|
|
|
|
|
|
check -path '*/explorer/*'
|
2021-01-12 06:14:24 +00:00
|
|
|
check -path '*/files/*' -name '*.sh'
|
2020-05-07 06:59:14 +00:00
|
|
|
check -name manifest
|
|
|
|
check -name gencode-local
|
|
|
|
check -name gencode-remote
|
2020-09-28 15:54:35 +00:00
|
|
|
|
|
|
|
if test -s "${SHELLCHECKTMP}"
|
|
|
|
then
|
|
|
|
cat "${SHELLCHECKTMP}" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|