Skip to content

Commit 556789f

Browse files
committed
ops: add pre-commit and hooks for checking
1 parent 9319618 commit 556789f

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

.pre-commit-config.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
ci:
2+
autofix_prs: false
3+
autoupdate_schedule: 'monthly'
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v5.0.0
8+
hooks:
9+
- id: check-case-conflict
10+
# Check for files with names that would conflict on a case-insensitive
11+
# filesystem like MacOS HFS+ or Windows FAT.
12+
- id: check-merge-conflict
13+
# Check for files that contain merge conflict strings.
14+
- id: check-symlinks
15+
# Checks for symlinks which do not point to anything.
16+
exclude: ".*(.github.*)$"
17+
- id: detect-private-key
18+
# Checks for the existence of private keys.
19+
- id: end-of-file-fixer
20+
# Makes sure files end in a newline and only a newline.
21+
exclude: ".*(data.*|extern.*|licenses.*|_static.*|\\.ya?ml)$"
22+
- id: trailing-whitespace
23+
# Trims trailing whitespace.
24+
exclude_types: [python]
25+
exclude: ".*(data.*|extern.*|licenses.*|_static.*|\\.ya?ml)$"
26+
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: v0.12.0
29+
hooks:
30+
- id: ruff-format
31+
types: [python]
32+
pass_filenames: true
33+
34+
- repo: local
35+
hooks:
36+
- id: pytest
37+
name: pytest test
38+
entry: pytest
39+
language: system
40+
types: [python]
41+
pass_filenames: false
42+
always_run: false
43+
args: ["-v", "--strict-markers"]
44+
45+
- id: mypy-check
46+
name: mypy type check
47+
entry: mypy
48+
language: system
49+
types: [python]
50+
pass_filenames: false
51+
52+
- id: maturin-develop
53+
name: maturin develop
54+
entry: maturin develop
55+
language: system
56+
types: [rust]
57+
pass_filenames: false
58+
59+
- id: cargo-fmt
60+
name: cargo fmt
61+
entry: cargo fmt
62+
language: system
63+
types: [rust]
64+
pass_filenames: false
65+
66+
- id: cargo-test
67+
name: cargo test
68+
entry: cargo test
69+
language: system
70+
types: [rust]

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ features = ["pyo3/extension-module"]
2929

3030
[project.optional-dependencies]
3131
test = ["pytest"]
32-
dev = ["ruff"]
32+
dev = ["ruff", "pre-commit"]
3333

3434
[tool.mypy]
3535
python_version = "3.11"
3636
strict = true
3737
files = "python/cocoindex"
38+
exclude = "(\\.venv|site-packages)"

0 commit comments

Comments
 (0)