-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
103 lines (95 loc) · 3.52 KB
/
.pre-commit-config.yaml
File metadata and controls
103 lines (95 loc) · 3.52 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
repos:
# Rust formatting and linting
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
name: Rust format
description: Format Rust code with rustfmt
entry: cargo fmt
language: system
files: \.rs$
pass_filenames: false
- id: cargo-check
name: Rust check
description: Check Rust code with cargo check
entry: bash -c 'if [[ "$OSTYPE" == "darwin"* ]]; then cargo check --all-targets --features simd,opencv,python-bindings,metal; else cargo check --all-targets --features simd,opencv,python-bindings; fi'
language: system
files: \.rs$
pass_filenames: false
- id: clippy
name: Rust clippy
description: Lint Rust code with clippy
entry: bash -c 'if [[ "$OSTYPE" == "darwin"* ]]; then cargo clippy --all-targets --features simd,opencv,python-bindings,metal; else cargo clippy --all-targets --features simd,opencv,python-bindings; fi'
language: system
files: \.rs$
pass_filenames: false
# Python formatting and linting
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3
files: \.py$
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
args: ["--profile", "black"]
files: \.py$
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
args: ["--max-line-length=88", "--extend-ignore=E203,W503"]
files: \.py$
# TOML formatting
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.15.0
hooks:
- id: pretty-format-toml
args: [--autofix]
# General hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: ['--maxkb=1000']
# Rust tests
- repo: local
hooks:
- id: rust-test
name: Rust tests
description: Run Rust tests
entry: bash -c 'if [[ "$OSTYPE" == "darwin"* ]]; then cargo test --features simd,opencv,metal -- --test-threads=1; else cargo test --features simd,opencv -- --test-threads=1; fi'
language: system
files: \.rs$
pass_filenames: false
stages: [pre-commit]
# Python tests (when bindings are built)
- repo: local
hooks:
- id: python-test
name: Python tests
description: Run Python tests
entry: bash -c 'if [ -d "target/wheels" ] || python -c "import trainingsample" 2>/dev/null; then pytest tests/ -v -m "not slow" -x; else echo "Python bindings not built, skipping Python tests"; fi'
language: system
files: \.(py|rs)$
pass_filenames: false
stages: [pre-commit]
# Competitive benchmarks (CI only - too heavy for local precommit)
- repo: local
hooks:
- id: competitive-benchmarks
name: Competitive performance benchmarks
description: Run competitive benchmarks against OpenCV/NumPy
entry: bash -c 'if [[ "$CI" == "true" ]] && ([ -d "target/wheels" ] || python -c "import trainingsample" 2>/dev/null); then pytest tests/test_competitive_benchmarks.py -v --tb=short; else echo "Skipping competitive benchmarks (not in CI or bindings not available)"; fi'
language: system
files: \.(py|rs)$
pass_filenames: false
stages: [pre-commit]