summaryrefslogtreecommitdiff
path: root/.githooks/pre-commit
diff options
context:
space:
mode:
Diffstat (limited to '.githooks/pre-commit')
-rwxr-xr-x.githooks/pre-commit24
1 files changed, 24 insertions, 0 deletions
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