-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding cargo fix to pre-commit hook (#488)
* cargo fix * add pre push hook generator script * pre push hook to run clippy checks * hook description to the readme * missing changes to the Readme * Update README.md Co-authored-by: Marcel Ebert <[email protected]> * update readme, add second clippy check --------- Co-authored-by: Marcel Ebert <[email protected]>
- Loading branch information
Showing
3 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ EOF | |
|
||
chmod +x .git/hooks/pre-commit | ||
|
||
echo "Hooks updated" | ||
echo "Hooks updated" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/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 | ||
echo "Running clippy for main targets" | ||
cargo clippy --all-features -- -W clippy::all -A clippy::style -A clippy::forget_copy -A clippy::forget_ref | ||
echo "Running clippy for all targets" | ||
cargo clippy --all-features --all-targets -- -A clippy::all -W clippy::correctness -A clippy::forget_copy -A clippy::forget_ref | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters