Create logging.sh

This commit is contained in:
Dennis Eichhorn 2017-09-25 13:02:54 +02:00 committed by GitHub
parent 1f2e919e32
commit a3c63609c2

17
Hooks/logging.sh Normal file
View File

@ -0,0 +1,17 @@
git diff --cached --name-only | while read FILE; do
if [[ "$FILE" =~ ^.+(php|js)$ ]]; then
RESULT=$(grep "var_dump(" "$FILE")
if [ ! -z $RESULT ]; then
echo -e "\e[1;33m\tWarning, the commit contains a call to var_dump(). Commit was not aborted, however.\e[0m" >&2
fi
fi
done
git diff --cached --name-only | while read FILE; do
if [[ "$FILE" =~ ^.+(php|js)$ ]]; then
RESULT=$(grep "console.log(" "$FILE")
if [ ! -z $RESULT ]; then
echo -e "\e[1;33m\tWarning, the commit contains a call to var_dump(). Commit was not aborted, however.\e[0m" >&2
fi
fi
done