Created
March 21, 2018 21:43
-
-
Save vochicong/9c58ffbe045772fc2d4010b0b7c63f41 to your computer and use it in GitHub Desktop.
Overcommit+Pronto+個別チェッカーで変なRubyコード(変更分+新規分)をコミットさせない ref: https://qiita.com/vochicong/items/b63d573dbdc24dfe02ad
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
PreCommit: | |
CustomScript: | |
enabled: true | |
command: ['bin/precommit.sh'] |
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
overcommit --install |
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
#!/usr/bin/env bash | |
set -x | |
# Pronto crashes on checking files not yet committed, | |
# therefore we reset them once and re-add later | |
newrubies=$(git diff --name-only --diff-filter=A HEAD |\ | |
grep -e '\.\(rb\|rake\)$' | tr '\n' ' ') | |
[ -z "${newrubies// }" ] && exit | |
git reset $newrubies | |
status=0 | |
bin/pronto run --staged || let ++status | |
git add $newrubies |
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
# Check those new files that not checked by Pronto | |
bin/flay `echo $newrubies` | |
bin/flog `echo $newrubies` | |
bin/reek -s `echo $newrubies` --failure-exit-code 0 | |
bin/rubocop `echo $newrubies` || let ++status | |
exit $status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment