chore: enable pre-commit for Rust formatting, pre-push for Rust linter check
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
#pnpm pretty-quick --staged
|
||||
|
||||
# 运行 clippy fmt
|
||||
#cargo fmt --manifest-path ./src-tauri/Cargo.toml
|
||||
cargo fmt --manifest-path ./src-tauri/Cargo.toml
|
||||
|
||||
# if [ $? -ne 0 ]; then
|
||||
# echo "rustfmt failed to format the code. Please fix the issues and try again."
|
||||
# exit 1
|
||||
# fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "rustfmt failed to format the code. Please fix the issues and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#git add .
|
||||
git add .
|
||||
|
||||
# 允许提交
|
||||
exit 0
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 运行 clippy
|
||||
#cargo clippy --manifest-path ./src-tauri/Cargo.toml --fix
|
||||
cargo clippy --manifest-path ./src-tauri/Cargo.toml --fix
|
||||
|
||||
# 如果 clippy 失败,阻止 push
|
||||
#if [ $? -ne 0 ]; then
|
||||
# echo "Clippy found issues in sub_crate. Please fix them before pushing."
|
||||
# exit 1
|
||||
#fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Clippy found issues in sub_crate. Please fix them before pushing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 允许 push
|
||||
exit 0
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user