blob: 322e6dafcfec2bd94f550274a2a43eb153821512 (
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
|
#!/bin/bash
set -e pipefail
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "$script_path/.."
if ! command -v shellcheck &>/dev/null ; then
echo "shellcheck is not available. Either skip this script, or install shellcheck."
exit 1
fi
ERRORS=()
while IFS= read -r f; do
if file "$f" | grep --quiet shell; then
{
shellcheck "$f" && echo -e "[\033[0;32mOK\033[0m]: successfully linted $f"
} || {
ERRORS+=("$f")
}
fi
done < <(git ls-files -- \
'*.sh' \
':!:Toolchain' \
':!:Ports' \
':!:Shell/Tests' \
)
if (( ${#ERRORS[@]} )); then
echo "Files failing shellcheck: ${ERRORS[*]}"
exit 1
fi
|