you-need-to-do-this-way/gradle/kotlin/hooks/ktlint-git-pre-commit-hook.sh

5 lines
175 B
Bash
Raw Permalink Normal View History

2021-03-08 13:13:25 +07:00
#!/bin/sh
# https://github.com/shyiko/ktlint pre-commit hook
git diff --name-only --relative | grep '\.kt[s"]\?$' | xargs ktlint --relative .
if [ $? -ne 0 ]; then exit 1; fi