Last active
August 15, 2021 10:05
-
-
Save tonilopezmr/88f651827a924993a6692b3bde2ca755 to your computer and use it in GitHub Desktop.
Pre-commit hook to run ktlint with auto-correct option and it adds the auto-correct changes into the commit.
This file contains hidden or 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 | |
# https://github.com/shyiko/ktlint pre-commit hook | |
git diff --name-only --cached --relative | grep '\.kt[s"]\?$' | xargs ktlint -F --relative . | |
if [ $? -ne 0 ]; then exit 1; else git add .; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment