Skip to content
Permalink
Browse files

Add linting as suggested by @jrbasso

  • Loading branch information...
jadb committed Mar 30, 2015
1 parent b237f5f commit 79771590f119f0b2268f2f20d202f3bc0e66fbf2
Showing with 15 additions and 2 deletions.
  1. +15 −2 contrib/pre-commit
@@ -1,5 +1,6 @@
#!/bin/sh
FILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
PROJECT=`php -r "echo dirname(dirname(realpath('$0')));"`

# Determine if a file list is passed
if [ "$#" -eq 1 ]
@@ -12,7 +13,19 @@ then
fi
SFILES=${SFILES:-$FILES}

if [ "$FILES" != "" ]
echo "Checking PHP Lint..."
for FILE in $SFILES
do
php -l -d display_errors=0 $PROJECT/$FILE
if [ $? != 0 ]
then
echo "Fix the error before commit."
exit 1
fi
FILES="$FILES $PROJECT/$FILE"
done

if [ "$SFILES" != "" ]
then
echo "Running PHPCS"
./vendor/bin/phpcs --standard=vendor/cakephp/cakephp-codesniffer/CakePHP $SFILES
@@ -22,4 +35,4 @@ then
exit 1
fi
fi
exit $?
exit $?

0 comments on commit 7977159

Please sign in to comment.
You can’t perform that action at this time.