forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_shellcheck.sh
executable file
·44 lines (35 loc) · 1.04 KB
/
check_shellcheck.sh
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
38
39
40
41
42
43
44
#!/bin/sh
@INCLUDE_COMMON@
echo
echo ELEKTRA SCRIPTS SHELLCHECK TEST
echo
command -v shellcheck > /dev/null 2>&1 || {
echo "shellcheck command needed for this test, aborting" >&2
exit 0
}
shellcheck_version=$(shellcheck --version | sed -n 's/version: //p')
shellcheck_required_version="0.7.1"
shellcheck_min_version=$(
printf '%s\n%s\n' "$shellcheck_version" "$shellcheck_required_version" |
sort -V |
head -1
)
if [ ! "$shellcheck_min_version" = "$shellcheck_required_version" ]; then
echo "shellcheck version ${shellcheck_required_version} or later required, aborting"
exit 0
fi
cd "@CMAKE_SOURCE_DIR@" || exit
# shellcheck disable=SC2046
set $(
{ . "scripts/dev/list-shell-scripts" && list_shell_scripts; } |
grep -v -f "tests/shell/check_shellcheck_ignorelist.txt"
)
printf 'Checking Scripts\n'
printf '————————————————\n\n'
for file; do printf '%s\n' "$file"; done
printf '\n'
shellcheck --severity=warning "$@"
ret=$?
test $ret -eq 0
exit_if_fail "shellcheck found an issue, please check."
end_script