Commit 4d70f183 authored by Benoit Mortier's avatar Benoit Mortier
Browse files

🤝 fix(git-hooks) add a var to select ghe home dir wher the php rules are


Signed-off-by: Benoit Mortier's avatarBenoit Mortier <benoit.mortier@opensides.be>
parent 2ad88f1b
#!/bin/sh
HOMEDIR="/home/bmortier/develop/project/fusiondirectory"
##### DONT CHANGE AFTER HERE #####
PROJECT=$(php -r "echo dirname(dirname(dirname(realpath('$0'))));")
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
......@@ -9,9 +13,9 @@ else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
STAGED_FILES_CMD=$(git diff --cached --name-only --diff-filter=ACMR $against| grep .php)
# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
......@@ -22,7 +26,7 @@ then
IFS=$oIFS
fi
SFILES=${SFILES:-$STAGED_FILES_CMD}
echo "Checking PHP Lint..."
for FILE in $SFILES ; do
php -l -d display_errors=0 $PROJECT/$FILE
......@@ -33,11 +37,11 @@ for FILE in $SFILES ; do
fi
FILES="$FILES $PROJECT/$FILE"
done
if [ "$SFILES" != "" ]
then
echo "Running Code Sniffer."
phpcs --standard=./dev-tools/php-codesniffer-rules/FDStandard/ruleset.xml $FILES
phpcs --standard=$HOMEDIR/dev-tools/php-codesniffer-rules/FDStandard/ruleset.xml $FILES
fi
exit $?
\ No newline at end of file
exit $?
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment