From 34793f98804d89fb986116188e9874fba9297cd4 Mon Sep 17 00:00:00 2001 From: Slinetrac Date: Sat, 13 Dec 2025 20:28:25 +0800 Subject: [PATCH] chore(husky): support cargo workspace --- .husky/pre-commit | 20 +++++++------------- .husky/pre-push | 10 ++-------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 4c21a0453..ea74c92fc 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -28,24 +28,18 @@ pnpm exec lint-staged RUST_FILES="$(git diff --cached --name-only --diff-filter=ACMR | grep -E '^src-tauri/.*\.rs$' || true)" if [ -n "$RUST_FILES" ]; then echo "[pre-commit] Formatting Rust changes with cargo fmt..." - ( - cd src-tauri - cargo fmt - ) + cargo fmt while IFS= read -r file; do [ -n "$file" ] && git add "$file" done <<< "$RUST_FILES" echo "[pre-commit] Linting Rust changes with cargo clippy..." - ( - cd src-tauri - cargo clippy-all - if ! command -v clash-verge-logging-check >/dev/null 2>&1; then - echo "[pre-commit] Installing clash-verge-logging-check..." - cargo install --git https://github.com/clash-verge-rev/clash-verge-logging-check.git - fi - clash-verge-logging-check - ) + cargo clippy-all + if ! command -v clash-verge-logging-check >/dev/null 2>&1; then + echo "[pre-commit] Installing clash-verge-logging-check..." + cargo install --git https://github.com/clash-verge-rev/clash-verge-logging-check.git + fi + clash-verge-logging-check fi TS_FILES="$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(ts|tsx)$' || true)" diff --git a/.husky/pre-push b/.husky/pre-push index 4f2a6a6b7..e1781c43f 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -25,16 +25,10 @@ pnpm typecheck if command -v cargo >/dev/null 2>&1; then echo "[pre-push] Verifying Rust formatting..." - ( - cd src-tauri - cargo fmt --check - ) + cargo fmt --check echo "[pre-push] Running cargo clippy..." - ( - cd src-tauri - cargo clippy-all - ) + cargo clippy-all else echo "[pre-push] ⚠️ cargo not found; skipping Rust checks." fi