-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
105 lines (95 loc) · 3.66 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
105
repos:
- repo: https://github.com/zakstucke/zetch
rev: v0.0.10
hooks:
- id: zetch
# Formats, lints, organises imports, handles tailwindcss classes in ts|tsx|js|jsx|cjs|json|jsonc etc.
# Formatting same as vscode extension: https://marketplace.visualstudio.com/items?itemName=biomejs.biome
# Configure from ./biome.json
- repo: https://github.com/biomejs/pre-commit
rev: "v0.1.0" # For now biome doesn't update this, biome version specified in additional_dependencies
hooks:
- id: biome-check
# Note when updating version, update the biome version in initial_setup.sh too for the local version
additional_dependencies: ["@biomejs/[email protected]"]
# Toml formatting,
# same as vscode extension: https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml
# Configure from ./taplo.toml
- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
hooks:
- id: taplo
args: ["format", "--config", "./taplo.toml"]
# Yaml formatting,
# same as vscode extension: https://marketplace.visualstudio.com/items?itemName=bluebrown.yamlfmt
# Configure from ./.yamlfmt
- repo: https://github.com/google/yamlfmt
# Note: if updating version, make sure to update your installed version,
# plus the installer in initial_setup.sh, which is needed for vscode extension.
rev: v0.10.0
hooks:
- id: yamlfmt
# Spelling mistakes:
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
# The codespell native exclude doesn't work,
# have to do it from pre-commit instead (https://github.com/codespell-project/codespell/issues/1498)
exclude: "(?x)^(\n .*\\.lock|\n .*\\.pyc|\n .*lock\\.json|\n .*rustfmt\\.toml|\n)$
\ \n"
args:
# Ignore don't error on specific words that always fail: (foo,bar,baz...)
- -L=crate
# Ruff: linting and formatting for python code:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
# Run the formatter.
- id: ruff-format
types_or: [python, pyi, jupyter]
args: [--config=./py_rust/ruff.toml]
# Run the linter.
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix, --config=./py_rust/ruff.toml]
# Cargo/clippy: linting and formatting for rust-backed python code:
- repo: local
hooks:
- id: cargo-fmt
name: cargo-fmt
description: "Format files with cargo fmt."
entry: cargo +nightly fmt
language: rust
types: [rust]
args: [--manifest-path=./py_rust/Cargo.toml, --]
- id: cargo-check
name: cargo-check-all-features
description: Check the package for errors.
entry: cargo +nightly check
language: rust
types: [rust]
args: [--manifest-path=./py_rust/Cargo.toml, --all-features]
pass_filenames: false
- id: cargo-check
name: cargo-check-default-features
description: Check the package for errors.
entry: cargo +nightly check
language: rust
types: [rust]
args: [--manifest-path=./py_rust/Cargo.toml]
pass_filenames: false
- id: cargo-clippy
name: cargo-clippy
description: Lint rust sources
entry: cargo +nightly clippy
language: rust
args: ["--manifest-path", "./py_rust/Cargo.toml", "--all-features", "--", "-D", "warnings"]
types: [rust]
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: trailing-whitespace