-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.pre-commit-config.yaml
104 lines (99 loc) · 3.2 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
default_install_hook_types: [pre-commit, commit-msg]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: no-commit-to-branch
- id: check-added-large-files
- id: check-toml
- id: check-json
exclude: (^|/)\.vscode(/.*|$)|.*tsconfig.* # json5
- id: check-yaml
args:
- --unsafe
exclude: pnpm-lock.yaml
- id: end-of-file-fixer
exclude: .*\/schemas\/.*\.json # generated automatically by `tauri-cli`
- id: trailing-whitespace
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.19.0
hooks:
- id: commitlint
stages: [commit-msg]
# NOTE: the dependencies must consistent with `commitlint.config.js`
additional_dependencies: ["@commitlint/config-conventional"]
- repo: local
hooks:
# ref: <https://github.com/astral-sh/uv-pre-commit/blob/97775dd8479651d7bc0f21fc2d0b960de1ef6267/.pre-commit-hooks.yaml#L11-L20>
- id: uv-lock
name: uv-lock
language: system
files: ^(uv\.lock|pyproject\.toml|uv\.toml)$
entry: uv lock
pass_filenames: false
- id: python-fmt
stages: [pre-commit]
name: python format
language: script
types: [python]
entry: scripts/python-fmt.sh
pass_filenames: false
- id: rust-fmt
stages: [pre-commit]
name: rust format
language: system
types: [rust]
entry: cargo fmt --all
pass_filenames: false
- id: typos
stages: [pre-commit]
name: typos
language: system
entry: typos -w
pass_filenames: false
- id: python-type-check
stages: [pre-commit]
name: python type check
language: system
types: [python]
entry: pnpm pyright .
pass_filenames: false
- id: python-verifytypes
stages: [manual] # because it's slow
name: python type check
language: script
types: [python]
entry: scripts/python-verifytypes.sh
pass_filenames: false
- id: cargo-clippy # rustup component add clippy
stages: [manual] # because it's slow
name: cargo clippy
language: system
types: [rust]
entry: cargo clippy --workspace --exclude=pytauri-test --all-features -- -D warnings
pass_filenames: false
- id: python-test
stages: [manual] # because it's slow
name: python test
language: script
types: [python]
# TODO: more tests
entry: scripts/python-test.sh
pass_filenames: false
- id: rust-test-all
stages: [manual] # because it's slow
name: rust test all
language: system
types: [rust]
entry: cargo test --workspace --exclude=pytauri-test --all-features
pass_filenames: false
- id: rust-test-crate
stages: [manual] # because it's slow
name: rust test crate
language: system
types: [rust]
entry: cargo test -p pytauri-test --features="test"
pass_filenames: false
# TODO, FIXME: typescript fmt
# TODO, FIXME: typescript check
# TODO, FIXME: rust doc check