gluon/scripts/lint-sh.sh
Jan-Tarek Butt 9417b89321 Makefile: add make targets lint, lint-sh, lint-lua
- move lint commands from Jerkinsfile into sh files.
2019-12-24 01:41:36 +01:00

29 lines
593 B
Bash
Executable File

#!/bin/sh
set -e
is_scriptfile() {
if echo "$1" | grep -qE '.*\.sh$' || head -n1 "$1" | grep -qE '^#.*(sh|bash)$'; then
return 0
fi
return 1
}
find contrib -type f | while read -r file; do
if is_scriptfile "$file"; then
shellcheck -f gcc "$file"
fi
done
find package -type f | while read -r file; do
if is_scriptfile "$file"; then
shellcheck -x -f gcc -s sh -eSC2039,SC1091,SC2155,SC2034 "$file"
fi
done
find scripts -type f | while read -r file; do
if is_scriptfile "$file"; then
shellcheck -f gcc -x -e SC2154,SC1090,SC2181,SC2155,SC2148,SC2034,SC2148 "$file"
fi
done