Build/Hooks/logging.sh
2018-06-24 16:50:00 +02:00

20 lines
599 B
Bash

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