Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # find all changed files about to be committed
- CHANGED_FILES=`git diff --cached --name-status --diff-filter=ACM | awk '{ print $2 }'`
- # filter through to get just the PHP files
- PHP_FILES=`echo $CHANGED_FILES | grep ".php$"`
- # loop through all of the PHP files and run the lint tool
- # one error should stop the entire commit, but it will continue to run through the remaining files
- FAILURE_DETECTED=0
- for FILE in $PHP_FILES
- do
- php -l $FILE
- if [ $? -ne 0 ]
- then
- FAILURE_DETECTED=1
- fi
- done
- exit $FAILURE_DETECTED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement