Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ examples: build
cargo run -p turnkey_examples --bin sub_organization
cargo run -p turnkey_examples --bin wallet
cargo run -p turnkey_examples --bin proofs

.PHONY: install-hooks
install-hooks:
@cp scripts/pre-commit .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@echo "Pre-commit hook installed."
22 changes: 22 additions & 0 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Pre-commit hook for rust-sdk
# Runs formatting and clippy for staged Rust changes.
# Install with: make install-hooks

set -euo pipefail

# Check if any Rust files are staged
STAGED_RS=$(git diff --cached --name-only --diff-filter=ACM | grep '\.rs$' || true)
STAGED_TOML=$(git diff --cached --name-only --diff-filter=ACM | grep 'Cargo\.toml$' || true)

# No Rust files staged, skip checks
if [ -z "$STAGED_RS" ] && [ -z "$STAGED_TOML" ]; then
echo "No relevant changes. Skipping rust pre-commit checks."
exit 0
fi
Comment thread
natefikru marked this conversation as resolved.

echo "Running pre-commit checks..."

make lint

echo "Pre-commit checks passed."
Loading