edge-connect-mcp/scripts/hooks/pre-commit

29 lines
619 B
Text
Raw Normal View History

2026-01-05 15:00:09 +01:00
#!/bin/bash
# ABOUTME: Pre-commit hook that runs formatting and linting checks.
# ABOUTME: Install with `make install-hooks`.
set -e
echo "Running pre-commit checks..."
# Run go fmt and check if there are any changes
echo "Checking formatting..."
UNFORMATTED=$(gofmt -l .)
if [ -n "$UNFORMATTED" ]; then
echo "Error: The following files are not formatted:"
echo "$UNFORMATTED"
echo ""
echo "Run 'make fmt' to format them."
exit 1
fi
# Run linter
echo "Running linter..."
make lint
2026-01-05 16:03:32 +01:00
# Check for secrets with gitleaks
echo "Checking for secrets..."
2026-01-07 14:57:33 +01:00
make gitleaks
2026-01-05 16:03:32 +01:00
2026-01-05 15:00:09 +01:00
echo "Pre-commit checks passed!"