summaryrefslogtreecommitdiff
path: root/ctdb/tests/UNIT/shellcheck/scripts/local.sh
blob: c069314b0aa527d5106db3727e8f506528680efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Hey Emacs, this is a -*- shell-script -*- !!!  :-)

. "${TEST_SCRIPTS_DIR}/script_install_paths.sh"

define_test ()
{
    _f=$(basename "$0" ".sh")

    printf "%-28s - %s\n" "$_f" "$1"
}
shellcheck_test ()
{
	ok_null
	if type shellcheck >/dev/null 2>&1 ; then
		# Skip some recent checks:
		#
		# SC1090: Can't follow non-constant source. Use a
		#         directive to specify location.
		# SC1091: Not following: FILE was not specified as
		#         input (see shellcheck -x).
		#         - Shellcheck doesn't handle our includes
		#           very well.  Adding directives to handle
		#           include for both in-tree and installed
		#           cases just isn't going to be possible.
		# SC2162: read without -r will mangle backslashes.
		#         - We never read things with backslashes,
		#           unnecessary churn.
		# SC2164: Use cd ... || exit in case cd fails.
		#         - Most hits are on known directories.  Too
		#           much churn, maybe later.
		_excludes="SC1090,SC1091,SC2162,SC2164"
		unit_test shellcheck --exclude="$_excludes" "$@"
	else
		ctdb_test_skip "shellcheck not installed"
		unit_test true
	fi
}