mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-02-08 23:58:39 +00:00
Implement shell linting
This commit is contained in:
parent
b23ed7b986
commit
a9864baae6
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
git diff --cached --name-only | while read FILE; do
|
git diff --cached --name-only | while read FILE; do
|
||||||
|
|
||||||
if [[ "$FILE" =~ ^.+(php|inc|module|install|test)$ ]]; then
|
if [[ "$FILE" =~ ^.+(php)$ ]]; then
|
||||||
if [[ -f $FILE ]]; then
|
if [[ -f $FILE ]]; then
|
||||||
|
|
||||||
# php lint
|
# php lint
|
||||||
php -l "$FILE" 1> /dev/null
|
php -l "$FILE" 1> /dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|
@ -28,4 +27,15 @@ if [[ "$FILE" =~ ^.+(php|inc|module|install|test)$ ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$FILE" =~ ^.+(sh)$ ]]; then
|
||||||
|
if [[ -f $FILE ]]; then
|
||||||
|
# sh lint
|
||||||
|
bash -n "$FILE" 1> /dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "\e[1;31m\tBash linting error.\e[0m" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
done || exit $?
|
done || exit $?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user