Last active
June 17, 2022 01:44
-
-
Save mmyoji/03225a5b48232b8b72f3c37d88d3d05c to your computer and use it in GitHub Desktop.
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 | |
# http://qiita.com/yuku_t/items/ad072418290a2b01a35a | |
# A: Added | |
# M: Modified | |
files=$(git diff --cached --name-only --diff-filter=AM | grep '\.rb$') | |
if [ -n "$files" ]; then | |
bundle exec rubocop --force-exclusion ${files} | |
# For docker: | |
# docker-compose run --rm <service-name> rubocop --force-exclusion ${files} | |
exit $? | |
fi | |
exit 0 |
Author
mmyoji
commented
Mar 23, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment