diff options
| author | Jomar Milan <jomarm@jomarm.com> | 2026-05-31 12:21:59 -0700 |
|---|---|---|
| committer | Jomar Milan <jomarm@jomarm.com> | 2026-05-31 12:21:59 -0700 |
| commit | e104c8ed4a41e790dfd03e822a923c4df7b082b3 (patch) | |
| tree | b8cc94a6085f370bcfce5b3244f92268bc7f895e /.githooks | |
| parent | 90d97e089d3b56e0e9efde3693f106d035bb88e8 (diff) | |
Add suggested pre-commit hook
Diffstat (limited to '.githooks')
| -rw-r--r-- | .githooks/README | 4 | ||||
| -rwxr-xr-x | .githooks/pre-commit | 24 |
2 files changed, 28 insertions, 0 deletions
diff --git a/.githooks/README b/.githooks/README new file mode 100644 index 0000000..2c18c82 --- /dev/null +++ b/.githooks/README @@ -0,0 +1,4 @@ +This directory contains suggested commit hooks for Git. You can symlink +specific Git hooks that you want to use, or you can set core.hooksPath to this +directory if you want to use all of them. Please make sure to check hooks before +you start to use them.
\ No newline at end of file diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..63b191d --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,24 @@ +#!/bin/sh + +set -eu + +if ! cargo fmt -- --check +then + echo "There are some code style issues." + echo "Run cargo fmt first." + exit 1 +fi + +if ! cargo clippy --all-targets -- -D warnings +then + echo "There are some clippy issues." + exit 1 +fi + +if ! cargo test +then + echo "There are some test issues." + exit 1 +fi + +exit 0
\ No newline at end of file |
