Created
May 23, 2020 18:00
-
-
Save anboo/2e3fed005e2af3403072b6ab57627bc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echoerr() { echo -e "\e[1;31m$@\e[0m" 1>&2; } | |
git diff --diff-filter=MAT --name-only --cached | while read line; | |
do | |
filename=$(tempfile)$(echo $line | sed 's/\//_/g'); | |
git show :$line > $filename; | |
if ! eval 'phpcs --standard=./vendor/escapestudios/symfony2-coding-standard/Symfony2 --extensions=php --ignore=Tests $filename > /dev/null'; then | |
if eval 'phpcs --standard=./vendor/escapestudios/symfony2-coding-standard/Symfony2 --extensions=php --ignore=Tests $line > /dev/null'; then | |
echoerr "!!!!ВНИМАНИЕ!!!!"; | |
echoerr "Кажется вы забыли сделать git add $line после того как сделали fix кодинг стайла, посмотрите git status:"; | |
git status; | |
else | |
#print more information about cs | |
phpcs --standard=./vendor/escapestudios/symfony2-coding-standard/Symfony2 --extensions=php --ignore=Tests $line | |
fi; | |
exit 1; | |
fi; | |
rm $filename; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment