mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
25 lines
712 B
Bash
Executable File
25 lines
712 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
echo "[pre-commit] Running lint-staged for JS/TS files..."
|
|
# Auto-fix staged JS/TS files, print warnings but don't fail commit
|
|
npx lint-staged || true
|
|
|
|
# Check staged Rust files
|
|
RUST_FILES=$(git diff --cached --name-only | grep -E '^src-tauri/.*\.rs$' || true)
|
|
if [ -n "$RUST_FILES" ]; then
|
|
echo "[pre-commit] Running rustfmt and clippy on staged Rust files..."
|
|
cd src-tauri || exit
|
|
|
|
# Auto-format Rust code
|
|
cargo fmt
|
|
|
|
# Lint with clippy, print warnings but don't fail commit
|
|
cargo clippy-all || echo "⚠️ clippy found issues, but commit will continue."
|
|
|
|
cd ..
|
|
fi
|
|
|
|
echo "[pre-commit] Checks completed. Some warnings may exist, please review."
|
|
exit 0
|