Skip to content

Commit 77092fa

Browse files
committed
CI: update precommit
1 parent 438fa75 commit 77092fa

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = "https://github.com/kojiishi/monitor-input-rs"
99
documentation = "http://docs.rs/monitor-input"
1010
readme = "README.md"
1111
license = "Apache-2.0"
12-
exclude = [".github", ".gitignore"]
12+
exclude = [".github", ".gitignore", "hooks"]
1313

1414
[dependencies]
1515
anyhow = "1.0.97"

hooks/precommit.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
#!/bin/bash
2-
set -x
3-
cargo test
4-
# cargo fmt --all --check
5-
cargo fmt --all
6-
# cargo clippy --all-targets --all-features -- -D warnings
7-
cargo clippy --fix --allow-dirty --all-targets --all-features -- -D warnings
2+
set -e
3+
(
4+
set -x
5+
cargo test --all-features
6+
)
7+
if [[ "$1" == '-f' ]]; then
8+
set -x
9+
cargo clippy --fix --allow-dirty --all-targets --all-features -- -D warnings
10+
cargo fmt --all
11+
git diff
12+
else
13+
set -x
14+
cargo clippy --all-targets --all-features -- -D warnings
15+
cargo fmt --all --check
16+
fi

0 commit comments

Comments
 (0)