From a3c63609c26011ad0eec4a7d1cec7e9f392f8f9a Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 25 Sep 2017 13:02:54 +0200 Subject: [PATCH] Create logging.sh --- Hooks/logging.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Hooks/logging.sh diff --git a/Hooks/logging.sh b/Hooks/logging.sh new file mode 100644 index 0000000..d696c5b --- /dev/null +++ b/Hooks/logging.sh @@ -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