Created
January 3, 2017 13:57
-
-
Save pseudomuto/6a094bb10d6ab576e92c9167181dbd79 to your computer and use it in GitHub Desktop.
Linting Pre-Push Hooks
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/bash | |
set -euo pipefail | |
###################################################################### | |
# Auto-formats code with RustFmt | |
# https://github.com/rust-lang-nursery/rustfmt | |
# | |
# After running, there will either be changes, or no changes. | |
# | |
# Possible outcomes: | |
# * No changes: push is executed | |
# * Changes: code has been formatted, user must accept the changes | |
###################################################################### | |
cargo fmt -- --write-mode=overwrite | |
# return 0 if nothing's changed or staged | |
git diff --exit-code && git diff-index --quiet --cached HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment