summaryrefslogtreecommitdiffstats
path: root/script/check-shell-scripts.sh
blob: f4f48a3bec34f0e3f3d84dad4922ec6ddb084022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

if [ $# -lt 1 ]; then
	echo "Usage: $(basename "${0}") DIR [SEVERITY]"
	exit 1
fi

DIR="${1}"
SEVERITY="${2:-error}"

shfmt -f "${DIR}" |
	grep -v -E "(bootstrap|third_party)" |
	xargs shellcheck \
		--shell=sh \
		--external-sources \
		--check-sourced \
		--format=gcc \
		--severity="${SEVERITY}"

exit $?