We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 00e90ad commit eccc224Copy full SHA for eccc224
scripts/pre-commit
@@ -0,0 +1,25 @@
1
+#!/bin/sh
2
+# Pre-commit hook to run cargo fmt
3
+#
4
+# To install this hook, run:
5
+# cp scripts/pre-commit .git/hooks/pre-commit
6
+# chmod +x .git/hooks/pre-commit
7
+
8
+echo "Running cargo fmt..."
9
10
+# Run cargo fmt on the entire workspace
11
+cargo fmt --all -- --check
12
13
+# Check if cargo fmt found any formatting issues
14
+if [ $? -ne 0 ]; then
15
+ echo ""
16
+ echo "❌ Code formatting issues detected!"
17
+ echo "Running 'cargo fmt --all' to fix formatting..."
18
+ cargo fmt --all
19
20
+ echo "✅ Formatting applied. Please review the changes and commit again."
21
+ exit 1
22
+fi
23
24
+echo "✅ Code formatting is correct!"
25
+exit 0
0 commit comments