Created
November 15, 2022 02:14
-
-
Save flaccus/1494c361514b6069036a5752d624e3c9 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/sh | |
# | |
# An hook script to apply prettier/rubocop rulse to what is about to be committed. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
### PRETTIER | |
git diff --cached --name-only --diff-filter=d | xargs ./node_modules/.bin/prettier -c | |
code=$? | |
if [ $code != 0 ]; then | |
echo "Error running prettier. Please fix any issues and re-run." | |
exit 1 | |
fi | |
### RUBOCOP | |
git diff --cached --name-only --diff-filter=d | xargs rubocop -a | |
code=$? | |
if [ $code != 0 ]; then | |
echo "Error running rubocop. Please fix any issues and re-run." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment