forked from nautechsystems/nautilus_trader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
186 lines (169 loc) · 5.64 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
186 lines (169 loc) · 5.64 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
repos:
##############################################################################
# General checks
##############################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: forbid-new-submodules
- id: end-of-file-fixer
types_or: [rust, cython, python, markdown]
- id: mixed-line-ending
- id: trailing-whitespace
- id: debug-statements
- id: detect-private-key
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: check-yaml
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
description: Checks for common misspellings.
types_or: [python, cython, rst, markdown]
args: ["-L", "ACN,crate,ot,socio-economic,zar"]
##############################################################################
# Custom hooks
##############################################################################
- repo: local
hooks:
- id: check-hidden-chars
name: check hidden unicode/control chars
description: Fail on hidden control or zero-width unicode characters in source
entry: .pre-commit-hooks/check_hidden_chars.sh
language: script
types_or: [rust, python, cython, toml, markdown, yaml, json, text]
files: '\.(rs|py|pyx|toml|md|yml|yaml|json|sh|dockerfile)$|Dockerfile.*'
- id: check-toml-codegen
name: check toml-codegen
description: Ensures TOML files don't contain the 'codegen-backend' keyword
entry: .pre-commit-hooks/check_toml_codegen.sh
language: script
files: \.toml$
- id: check-todo-exclamation
name: check todo! markers
description: Prevents committing TODO! markers that indicate incomplete work
entry: .pre-commit-hooks/check_todo_exclamation.sh
language: script
types: [text]
pass_filenames: false
##############################################################################
# Rust formatting and linting
##############################################################################
- repo: local
hooks:
- id: fmt
name: cargo fmt
description: Format files with cargo fmt.
entry: cargo fmt
language: system
args: ["--all", "--", "--check"]
files: '\.(rs|toml)$'
types: [file]
pass_filenames: false
- id: cargo-clippy
name: cargo clippy
description: Run the Clippy linter on the package.
entry: cargo clippy
language: system
args: ["--features", "high-precision,ffi,python,extension-module", "--", "-D", "warnings"]
files: '\.(rs|toml)$'
types: [file]
pass_filenames: false
- id: cargo-doc
name: cargo doc
description: Check documentation builds without errors or warnings.
entry: bash -c 'RUSTDOCFLAGS="--cfg docsrs -D warnings" cargo doc --all-features --no-deps --workspace --quiet'
language: system
files: '\.(rs|toml)$'
types: [file]
pass_filenames: false
##############################################################################
# Python/Cython formatting and linting
##############################################################################
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.2.0
hooks:
- id: add-trailing-comma
name: add-trailing-comma
types: [python]
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
types_or: [python, pyi]
entry: "black"
args: ["--config", "pyproject.toml"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
name: isort (cython)
types_or: [cython]
entry: "isort"
args: ["--settings-file", "pyproject.toml"]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.7
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [
"--black",
"--make-summary-multi-line",
"--pre-summary-newline",
"--blank",
"--recursive",
"--in-place",
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.1
hooks:
- id: mypy
args: [
"--config", "pyproject.toml",
"--allow-incomplete-defs",
]
additional_dependencies: [
msgspec,
types-frozendict,
types-pytz,
types-redis,
types-requests,
types-toml,
]
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.13 # uv version
hooks:
- id: uv-lock
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.17.2 # Pin v0.17.2 to depend on default node version for GitHub actions runners
hooks:
- id: markdownlint-cli2
name: markdownlint
entry: markdownlint-cli2
args:
- --config
- .markdownlint.jsonc
- --fix
files: "\\.md$"
exclude: '^(CLA\.md|CONTRIBUTING\.md|RELEASES\.md)$'