Created
February 21, 2017 01:33
-
-
Save app2641/25717922d4f038b1e8a5a772c6a88d9b to your computer and use it in GitHub Desktop.
.git/hooks/pre-commit
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/sh | |
git df --cached --name-only --diff-filter=AM | grep '\.rb$' | grep -v 'db/schema.rb' | xargs bundle exec rubocop -c .rubocop.yml | |
RUBOCOP=$? | |
git df --cached --name-only --diff-filter=AM | grep '\.js$' | xargs npm run lint | |
ESLINT=$? | |
if [ $RUBOCOP -eq $ESLINT ]; then | |
exit 0 | |
else | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment