Merge pull request #10453 from thalesmg/mix-fmt-pre-commit-hook

ci: check if Elixir files are formatted in pre-commit hook
This commit is contained in:
Zaiming (Stone) Shi 2023-04-21 13:51:31 +02:00 committed by GitHub
commit fbc744419f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,9 @@ set -euo pipefail
OPT="${1:--c}"
# mix format check is quite fast
mix format --check-formatted
files_dirty="$(git diff --name-only | grep -E '.*\.erl' || true)"
files_cached="$(git diff --cached --name-only | grep -E '.*\.erl' || true)"
if [[ "${files_dirty}" == '' ]] && [[ "${files_cached}" == '' ]]; then