-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
119 lines (108 loc) · 3.23 KB
/
.pre-commit-config.yaml
File metadata and controls
119 lines (108 loc) · 3.23 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
# Pre-commit hooks for project-x-py SDK
# Python 3.12+ compatible
default_language_version:
python: python3.12
repos:
# Ruff - Fast Python linter and formatter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --ignore, UP046]
exclude: ^(tests/|examples/|benchmarks/|scripts/)
- id: ruff-format
exclude: ^(tests/|examples/|benchmarks/|scripts/)
# MyPy - Type checking (src only, not tests)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
args: [--config-file, pyproject.toml, --ignore-missing-imports]
additional_dependencies:
- types-requests
- types-pytz
- types-pyyaml
- types-deprecated
- types-psutil
files: ^src/
exclude: ^(tests/|src/project_x_py/utils/lock_benchmarker\.py)
# Bandit - Security linter (src only)
- repo: https://github.com/PyCQA/bandit
rev: 1.8.0
hooks:
- id: bandit
args: [-ll] # Low level issues
files: ^src/
exclude: ^(tests/|examples/|benchmarks/|scripts/)
# Detect Secrets
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
exclude: package-lock.json
# Check for async compliance (src only) - TEMPORARILY DISABLED
# - repo: local
# hooks:
# - id: check-async
# name: Check 100% async compliance
# entry: python scripts/check_async.py
# language: python
# files: ^src/project_x_py/.*\.py$
# exclude: ^tests/
# pass_filenames: true
# require_serial: false
# Check for pandas usage (forbidden in src)
- repo: local
hooks:
- id: no-pandas
name: Check for pandas usage
entry: '(import pandas|from pandas|pd\.)'
language: pygrep
files: ^src/.*\.py$
exclude: ^tests/
# Verify test.sh usage in examples
- repo: local
hooks:
- id: test-sh-usage
name: Verify test.sh usage in examples
entry: 'uv run python examples/'
language: pygrep
files: ^(examples|docs)/.*\.(py|md)$
types: [text]
# Standard pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: mkdocs.yml
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: debug-statements
- id: mixed-line-ending
args: ['--fix=lf']
# Check for TODO comments
- repo: local
hooks:
- id: todo-check
name: Check TODO format
entry: 'TODO(?!:)'
language: pygrep
types: [python]
exclude: ^scripts/
# Verify Python 3.12+ features
- repo: local
hooks:
- id: python-version-check
name: Check Python 3.12+ compatibility
entry: python scripts/check_python_version.py
language: python
files: ^src/.*\.py$
exclude: ^tests/
pass_filenames: false