-
Notifications
You must be signed in to change notification settings - Fork 7
/
.pre-commit-config.yaml
104 lines (103 loc) · 3.19 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 # Use the ref you want to point at
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-toml
- id: check-vcs-permalinks
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
exclude: |
(?x)^(
specification/schema/.*|
.*\.snap|
.*\.snap\.new|
.*\.ambr|
.release-please-manifest.json
)$
- id: trailing-whitespace
exclude: |
(?x)^(
specification/schema/.*|
.*\.snap|
.*\.ambr|
.*\.snap\.new
)$
- id: fix-byte-order-marker
- id: mixed-line-ending
# Python-specific
- id: check-ast
- id: check-docstring-first
- id: debug-statements
- repo: local
hooks:
- id: ruff-format
name: ruff format
description: Format python code with `ruff`.
entry: uv run ruff format
language: system
files: \.py$
pass_filenames: false
- id: ruff-check
name: ruff
description: Check python code with `ruff`.
entry: uv run ruff check --fix --exit-non-zero-on-fix
language: system
files: \.py$
pass_filenames: false
- id: mypy-check
name: mypy
description: Check python code with `mypy`.
entry: uv run mypy .
language: system
files: \.py$
pass_filenames: false
- id: cargo-fmt
name: cargo format
description: Format rust code with `cargo fmt`.
entry: cargo fmt --all -- --check
language: system
files: \.rs$
pass_filenames: false
- id: cargo-check
name: cargo check
description: Check rust code with `cargo check`.
entry: cargo check --all --all-features --workspace
language: system
files: \.rs$
pass_filenames: false
- id: cargo-test
name: cargo test
description: Run tests with `cargo test`.
entry: cargo test --all-features --workspace
language: system
files: \.rs$
pass_filenames: false
- id: cargo-clippy
name: cargo clippy
description: Run clippy lints with `cargo clippy`.
entry: cargo clippy --all-targets --all-features --workspace -- -D warnings
language: system
files: \.rs$
pass_filenames: false
- id: cargo-doc
name: cargo doc
description: Generate documentation with `cargo doc`.
entry: sh -c "RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features --workspace"
language: system
files: \.rs$
pass_filenames: false
- id: py-test
name: pytest
description: Run python tests
# We need to rebuild `hugr-cli` without the `extension_inference` feature
# to avoid test errors.
# TODO: Remove this once the issue is fixed.
entry: sh -c "cargo build -p hugr-cli && uv run pytest"
language: system
files: \.py$
pass_filenames: false