-
Notifications
You must be signed in to change notification settings - Fork 802
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
115 lines (104 loc) · 4.3 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
115 lines (104 loc) · 4.3 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
# Check for files with names that would conflict on a case-insensitive
# filesystem like MacOS HFS+ or Windows FAT.
- id: check-merge-conflict
# Check for files that contain merge conflict strings.
- id: check-symlinks
# Checks for symlinks which do not point to anything.
exclude: ".*(.github.*)$"
- id: detect-private-key
# Checks for the existence of private keys.
# gdrive.rs holds a throwaway test-only RSA key (RS256 JWT signing test);
# oci_object_storage.rs only references the PEM key header in doc comments.
# (This comment must avoid the literal key-header phrase, or the hook would
# flag its own config file.)
exclude: "^rust/sdk/cocoindex/src/(gdrive|oci_object_storage)\\.rs$"
- id: end-of-file-fixer
# Makes sure files end in a newline and only a newline.
exclude: ".*(data.*|licenses.*|_static.*|\\.ya?ml|\\.jpe?g|\\.png|\\.svg|\\.webp)$"
- id: trailing-whitespace
# Trims trailing whitespace.
exclude_types: [python] # Covered by Ruff W291.
exclude: ".*(data.*|licenses.*|_static.*|\\.ya?ml|\\.jpe?g|\\.png|\\.svg|\\.webp)$"
- repo: local
hooks:
- id: cargo-fmt
name: cargo fmt
entry: cargo fmt
language: system
types: [rust]
pass_filenames: false
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0
hooks:
- id: ruff-format
types: [python]
pass_filenames: true
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.6.1
hooks:
- id: uv-lock
# Ensures uv.lock is up to date with pyproject.toml
- repo: local
hooks:
- id: mypy-check
name: mypy type check
entry: uv run mypy
language: system
files: ^(python/|examples/|benchmarks/|pyproject\.toml)
pass_filenames: false
- id: maturin-develop
name: maturin develop
entry: ./dev/run_maturin_develop.sh
language: system
files: ^(rust/|python/|Cargo\.toml|pyproject\.toml)
pass_filenames: false
- id: cargo-test
name: cargo test
entry: ./dev/run_cargo_test.sh
language: system
files: ^(rust/|Cargo\.toml)
pass_filenames: false
- id: update-rust-extern-locks
name: update Cargo.lock (rust examples + benchmarks)
entry: ./dev/update_rust_extern_locks.sh
language: system
# Any rust/ change can shift the cocoindex SDK's transitive deps and
# stale these external lockfiles, so trigger on the whole rust tree.
# Ordered before cargo-test-rust-externs so a refresh in the same run
# satisfies its `--locked` check.
files: ^(rust/|examples/rust/|benchmarks/.*/rust/|Cargo\.toml)
pass_filenames: false
- id: cargo-test-rust-externs
name: cargo check (rust examples + benchmarks)
entry: ./dev/run_cargo_test_rust_externs.sh
language: system
files: ^(rust/sdk/|examples/rust/|benchmarks/.*/rust/)
pass_filenames: false
- id: cargo-tree-sdk-no-pyo3
name: cargo tree (cocoindex SDK must not depend on pyo3)
entry: ./dev/check_sdk_no_pyo3.sh
language: system
files: ^(rust/sdk/|rust/core/|rust/utils/|Cargo\.toml)
pass_filenames: false
- id: pytest
name: pytest
entry: uv run pytest python/
language: system
types: [python]
pass_filenames: false
always_run: false
- id: generate-cli-docs
name: generate CLI documentation
entry: uv run python dev/generate_cli_docs.py
language: system
# Includes cli.mdx itself so a manual edit to the generated file
# re-runs the generator and is caught on PR CI (which runs prek only
# on changed files). Otherwise a hand-edit to cli.mdx slips through
# every PR and only surfaces on the all-files run after merge to main.
files: ^(python/cocoindex/cli\.py|dev/generate_cli_docs\.py|docs/src/content/docs/cli\.mdx)$
pass_filenames: false