Created
October 14, 2016 06:50
-
-
Save stowball/e2c7caef2d7767cc73ee908926722879 to your computer and use it in GitHub Desktop.
totvs pre-commit hook
This file contains hidden or 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/sh | |
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$") | |
if [ "$files" = "" ]; then | |
exit 0 | |
fi | |
eslint=$PWD/app/web-apps/node_modules/gulp-eslint/node_modules/eslint/bin/eslint.js | |
for file in ${files}; do | |
result=$($eslint -c app/web-apps/mdm-ui/.eslintrc ${file}) | |
if [[ "$result" == *"problem"* ]]; then | |
$eslint -c app/web-apps/mdm-ui/.eslintrc ${files} | |
echo "\033[41mCOMMIT FAILED:\033[0m Your commit contains lint errors and/or warnings\n" | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment