Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding cargo fix to pre-commit hook #488

Merged
merged 8 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .maintain/add-precommit-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ EOF

chmod +x .git/hooks/pre-commit

echo "Hooks updated"
echo "Hooks updated"
22 changes: 22 additions & 0 deletions .maintain/add-prepush-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# write a whole script to pre-push hook
# NOTE: it will overwrite pre-push file!
cat > .git/hooks/pre-push <<'EOF'
#!/bin/bash

echo "Running clippy checks"

set +e

cargo clippy --all-features -- -W clippy::all -A clippy::style -A clippy::forget_copy -A clippy::forget_ref
ebma marked this conversation as resolved.
Show resolved Hide resolved
CLIPPY_EXIT_CODE=$?

set -e

if [ $CLIPPY_EXIT_CODE -ne 0 ]; then
echo "Error: Clippy checks failed" >&2
exit $CLIPPY_EXIT_CODE
fi

echo "Clippy checks successful"
Loading