-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
156 lines (155 loc) · 5.31 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
156 lines (155 loc) · 5.31 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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)^(
test_files/.*|
.*/snapshots/.*|
.*.snap|
.*.snap.new|
.release-please-manifest.json|
.*.lock
)$
- id: trailing-whitespace
exclude: |
(?x)^(
test_files/.*|
.*/snapshots/.*|
.*.snap|
.*.snap.new|
.*.lock
)$
- 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$
exclude: ^pg-libs/
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$
exclude: ^pg-libs/
pass_filenames: false
- id: mypy-check
name: mypy
description: Check python code with `mypy`.
entry: uv run --all-extras mypy .
language: system
files: \.py$
pass_filenames: false
- id: cargo-fmt
name: cargo format
description: Format rust code with `cargo fmt`.
entry: uv run -- cargo fmt --all -- --check
language: system
files: \.rs$
exclude: ^pg-libs/
pass_filenames: false
- id: cargo-check
name: cargo check
description: Check rust code with `cargo check`.
entry: env RUSTFLAGS="-Dwarnings" uv run -- cargo check --all --all-features --workspace
language: system
files: \.rs$
exclude: ^pg-libs/
pass_filenames: false
- id: cargo-test
name: cargo nextest r
description: Run tests with `cargo nextest r`.
entry: uv run -- cargo nextest r --all-features
language: system
files: \.rs$
exclude: ^pg-libs/
pass_filenames: false
- id: cargo-clippy
name: cargo clippy
description: Run clippy lints with `cargo clippy`.
entry: uv run -- cargo clippy --all-features --all-targets --workspace -- -D warnings
language: system
files: \.rs$
exclude: ^pg-libs/
pass_filenames: false
- id: cargo-doc
name: cargo doc
description: Generate documentation with `cargo doc`.
entry: uv run -- cargo doc --no-deps --all-features --workspace
language: system
files: \.rs$
exclude: ^pg-libs/
pass_filenames: false
# pg-libs hooks (separate Cargo/uv workspace)
- id: ruff-format-pg-libs
name: ruff format (pg-libs)
description: Format pg-libs python code with `ruff`.
entry: sh -c "cd pg-libs && uv run ruff format"
language: system
files: ^pg-libs/.*\.py$
pass_filenames: false
- id: ruff-check-pg-libs
name: ruff (pg-libs)
description: Check pg-libs python code with `ruff`.
entry: sh -c "cd pg-libs && uv run ruff check --fix --exit-non-zero-on-fix"
language: system
files: ^pg-libs/.*\.py$
pass_filenames: false
- id: cargo-fmt-pg-libs
name: cargo format (pg-libs)
description: Format pg-libs rust code with `cargo fmt`.
entry: sh -c "cd pg-libs && cargo fmt --all -- --check"
language: system
files: ^pg-libs/.*\.rs$
pass_filenames: false
- id: cargo-check-pg-libs
name: cargo check (pg-libs)
description: Check pg-libs rust code with `cargo check`.
entry: sh -c "cd pg-libs && env RUSTFLAGS='-Dwarnings' cargo check --all-features --workspace"
language: system
files: ^pg-libs/.*\.rs$
pass_filenames: false
- id: cargo-clippy-pg-libs
name: cargo clippy (pg-libs)
description: Run clippy lints on pg-libs with `cargo clippy`.
entry: sh -c "cd pg-libs && cargo clippy --all-features --all-targets --workspace -- -D warnings"
language: system
files: ^pg-libs/.*\.rs$
pass_filenames: false
- id: cargo-test-pg-libs
name: cargo nextest r (pg-libs)
description: Run pg-libs tests with `cargo nextest r`.
# cd into pg-libs so Cargo picks up pg-libs/.cargo/config.toml.
entry: sh -c "cd pg-libs && cargo nextest r --all-features"
language: system
files: ^pg-libs/.*\.rs$
pass_filenames: false
- id: py-test
name: pytest
description: Run python tests
# Ensure that we are using the local version of `tket-eccs` and not the one from PyPI
entry: uv run -- sh -c "maturin develop && pytest --cov=./ --cov-report=html"
language: system
files: \.py$
exclude: ^pg-libs/
pass_filenames: false