mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 17:15:38 +08:00
chore(husky): support cargo workspace
This commit is contained in:
@@ -28,24 +28,18 @@ pnpm exec lint-staged
|
|||||||
RUST_FILES="$(git diff --cached --name-only --diff-filter=ACMR | grep -E '^src-tauri/.*\.rs$' || true)"
|
RUST_FILES="$(git diff --cached --name-only --diff-filter=ACMR | grep -E '^src-tauri/.*\.rs$' || true)"
|
||||||
if [ -n "$RUST_FILES" ]; then
|
if [ -n "$RUST_FILES" ]; then
|
||||||
echo "[pre-commit] Formatting Rust changes with cargo fmt..."
|
echo "[pre-commit] Formatting Rust changes with cargo fmt..."
|
||||||
(
|
cargo fmt
|
||||||
cd src-tauri
|
|
||||||
cargo fmt
|
|
||||||
)
|
|
||||||
while IFS= read -r file; do
|
while IFS= read -r file; do
|
||||||
[ -n "$file" ] && git add "$file"
|
[ -n "$file" ] && git add "$file"
|
||||||
done <<< "$RUST_FILES"
|
done <<< "$RUST_FILES"
|
||||||
|
|
||||||
echo "[pre-commit] Linting Rust changes with cargo clippy..."
|
echo "[pre-commit] Linting Rust changes with cargo clippy..."
|
||||||
(
|
cargo clippy-all
|
||||||
cd src-tauri
|
if ! command -v clash-verge-logging-check >/dev/null 2>&1; then
|
||||||
cargo clippy-all
|
echo "[pre-commit] Installing clash-verge-logging-check..."
|
||||||
if ! command -v clash-verge-logging-check >/dev/null 2>&1; then
|
cargo install --git https://github.com/clash-verge-rev/clash-verge-logging-check.git
|
||||||
echo "[pre-commit] Installing clash-verge-logging-check..."
|
fi
|
||||||
cargo install --git https://github.com/clash-verge-rev/clash-verge-logging-check.git
|
clash-verge-logging-check
|
||||||
fi
|
|
||||||
clash-verge-logging-check
|
|
||||||
)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TS_FILES="$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(ts|tsx)$' || true)"
|
TS_FILES="$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(ts|tsx)$' || true)"
|
||||||
|
|||||||
@@ -25,16 +25,10 @@ pnpm typecheck
|
|||||||
|
|
||||||
if command -v cargo >/dev/null 2>&1; then
|
if command -v cargo >/dev/null 2>&1; then
|
||||||
echo "[pre-push] Verifying Rust formatting..."
|
echo "[pre-push] Verifying Rust formatting..."
|
||||||
(
|
cargo fmt --check
|
||||||
cd src-tauri
|
|
||||||
cargo fmt --check
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "[pre-push] Running cargo clippy..."
|
echo "[pre-push] Running cargo clippy..."
|
||||||
(
|
cargo clippy-all
|
||||||
cd src-tauri
|
|
||||||
cargo clippy-all
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
echo "[pre-push] ⚠️ cargo not found; skipping Rust checks."
|
echo "[pre-push] ⚠️ cargo not found; skipping Rust checks."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user