Skip to content

Instantly share code, notes, and snippets.

@supercid
Last active September 25, 2019 10:44
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 supercid/4a85f15f9f7ff5b87b232d753cb10876 to your computer and use it in GitHub Desktop.
Save supercid/4a85f15f9f7ff5b87b232d753cb10876 to your computer and use it in GitHub Desktop.
Run m2 checks before commit
#!/bin/sh
export PATH=/usr/local/bin:$PATH
ROOT=`git rev-parse --show-toplevel`
if [ ! -d "$ROOT/vendor" ]; then
echo "Run composer install to run checkstyles"
exit 1
fi
## Code sniffer
$ROOT/vendor/bin/phpcs --standard=ruleset.xml || exit 1
## PHPMD
$ROOT/vendor/bin/phpmd . xml codesize,naming,unusedcode,controversial,design --exclude vendor,var,build,tests || exit 1
## PHAN
$ROOT/vendor/bin/phan --config-file=phan.php || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment