topaz2/chef_boilerplate_php

View on GitHub
files/default/git/hooks/cakephp/phpcs

Summary

Maintainability
Test Coverage
#!/bin/bash -e

PROJECT=`php -r "echo dirname(dirname(dirname(dirname(realpath('$0')))));"`

FILES=""
for FILE in `git diff --cached --name-only --diff-filter=ACMR HEAD | egrep \\\\.\(php\)\$`
do
  FILES="$FILES $PROJECT/$FILE"
done

if [ "$FILES" != "" ]
then
  echo "Running phpcs..."
  phpcs --extensions=php --standard=CakePHP --encoding=utf-8 $FILES || exit $?
fi

exit 0