Skip to content

Instantly share code, notes, and snippets.

@Daniel-Worrall
Last active July 31, 2021 11:47
Embed
What would you like to do?
Crystal pre-commit - Just put in .git/hooks folder
#!/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