Last active
July 31, 2021 11:47
-
-
Save Daniel-Worrall/d8b060ba1289d4ee63277d8504eaab55 to your computer and use it in GitHub Desktop.
Crystal pre-commit - Just put in .git/hooks folder
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 | |
changed_cr_files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.cr$') | |
[ -z "$changed_cr_files" ] && exit 0 | |
crystal tool format $changed_cr_files | |
shards check || exit 1 | |
bin/ameba -f flycheck $changed_cr_files || exit 1 | |
crystal spec --fail-fast >/dev/null || echo "Specs failed."; exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment