Skip to content

Instantly share code, notes, and snippets.

@seqizz
Created February 21, 2014 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seqizz/9135843 to your computer and use it in GitHub Desktop.
Save seqizz/9135843 to your computer and use it in GitHub Desktop.
#!/bin/sh
USRHOMEDIR=`echo $(cd ~)`/
FIXER=php-cs-fixer.phar
PROJECTROOT="$1"
if [ ! -e ${USRHOMEDIR}${FIXER} ]; then
echo "PHP-CS-Fixer not available, downloading to ${USRHOMEDIR}${FIXER}..."
curl -s http://cs.sensiolabs.org/get/$FIXER > ${USRHOMEDIR}${FIXER}
echo "Done. First time to check the Coding Standards."
echo ""
fi
RES=`php ${USRHOMEDIR}${FIXER} fix $PROJECTROOT --verbose --dry-run`
if [ "$RES" != "" ]; then
echo "Coding standards are not correct, cancelling your commit."
echo ""
echo $RES
echo ""
echo "If you want to fix them run:"
echo ""
echo " php ${USRHOMEDIR}${FIXER} fix ${PROJECTROOT} --verbose"
echo ""
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment