Skip to content

Instantly share code, notes, and snippets.

@bayleedev
Last active August 29, 2015 14:03
Show Gist options
  • Save bayleedev/02f7a3291bd99779c486 to your computer and use it in GitHub Desktop.
Save bayleedev/02f7a3291bd99779c486 to your computer and use it in GitHub Desktop.
Report PHP CodeSniffer errors and warnings to graphite.
GRAPHITE_PORT=2003
GRAPHITE_SERVER="127.0.0.1"
ERROR_PATH="project.codesniff.errors"
WARNING_PATH="project.codesniff.warnings"
APP_PATH="/var/www/apps/project/app"
APP_STANDARD="PEAR"
SETUP="cd ${APP_PATH} && git fetch origin > /dev/null 2>&1 && git reset --hard origin/dev > /dev/null 2>&1 && php composer.phar install > /dev/null 2>&1"
RESPONSE=`${SETUP} && ./bin/phpcs --standard=${APP_STANDARD} --report=summary ./ | grep TOTAL | awk -v ERROR_PATH=${ERROR_PATH} -v WARNING_PATH=${WARNING_PATH} '{ print ERROR_PATH,$4, strftime("%s") "\\\\n" WARNING_PATH, $7,strftime("%s") }'`
echo -e $RESPONSE | nc ${GRAPHITE_SERVER} ${GRAPHITE_PORT};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment