Advertisement
Guest User

Untitled

a guest
May 27th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # find all changed files about to be committed
  4. CHANGED_FILES=`git diff --cached --name-status --diff-filter=ACM | awk '{ print $2 }'`
  5.  
  6. # filter through to get just the PHP files
  7. PHP_FILES=`echo $CHANGED_FILES | grep ".php$"`
  8.  
  9. # loop through all of the PHP files and run the lint tool
  10. # one error should stop the entire commit, but it will continue to run through the remaining files
  11. FAILURE_DETECTED=0
  12. for FILE in $PHP_FILES
  13. do
  14. php -l $FILE
  15. if [ $? -ne 0 ]
  16. then
  17. FAILURE_DETECTED=1
  18. fi
  19. done
  20.  
  21. exit $FAILURE_DETECTED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement