rust notes pre-push hook make sure we add proper code before pushing and triggering ci/cd .git/hooks/pre-push#!/bin/bashset -e echo "Running Rust pre-push checks..." # 1. Format codeecho "Formatting code..."cargo fmt --all -- --check || (cargo fmt --all && git add -u && echo "Code was formatted. Please review changes and commit again." && exit 1) # 2. Run clippyecho "Running clippy..."cargo clippy --all-targets --all-features -- -D warnings # 3. Run testsecho "Running tests..."cargo test --all # 4. Check for outdated dependencies (if cargo-outdated is installed)if command -v cargo-outdated &> /dev/nullthen echo "Checking for outdated dependencies..." cargo outdated --exit-code 1else echo "cargo-outdated is not installed. Skipping outdated dependencies check." echo "To install, run: cargo install cargo-outdated"fi # 5. Run security audit (if cargo-audit is installed)if command -v cargo-audit &> /dev/nullthen echo "Running security audit..." cargo auditelse echo "cargo-audit is not installed. Skipping security audit." echo "To install, run: cargo install cargo-audit"fi # 6. Build documentationecho "Building documentation..."cargo doc --no-deps # 7. Run benchmarks (optional, can be time-consuming)# echo "Running benchmarks..."# cargo bench echo "All pre-push checks passed successfully!" dry-run tip call git push with --dry-run to see if the hook is working as expected