-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.sh
executable file
·40 lines (36 loc) · 1.01 KB
/
check.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
#!/usr/bin/env bash
# shellcheck disable=SC2086
set -euf -o pipefail
expectCommand() {
local -r name="${1:?Expected command name}"
if ! command -v "${name}" &>/dev/null; then
echo "Missing command: ${name}"
exit
fi
}
checkBashScripts() {
expectCommand shellcheck
local -r files="$(find . -type f -name "*.sh" \
-not -path "./.install/*" \
-not -path "*/deps/*" \
-not -path "*/plugins/*" \
-not -path "*/tmp/*" \
-not -path "*/.luarocks/*" \
-not -path "./_sysinit/*/templates/*")"
echo -e "\n>>> Running ShellCheck for bash"
shellcheck $files
echo -e "<<< ShellCheck passed\n"
}
checkLuaScripts() {
expectCommand luacheck
echo -e "\n>>> Running Luacheck"
local -r files="$(find . -type f -name "*.lua" \
-not -path "./.install/*" \
-not -path "*/deps/*" \
-not -path "*/.luarocks/*" \
-not -path "*/tmp/*")"
luacheck $files --globals vim TreeExplorer --exclude-files "**/packer_compiled.lua"
echo -e "<<< Luacheck passed\n"
}
checkLuaScripts
checkBashScripts