-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
198 lines (163 loc) · 5.1 KB
/
.pre-commit-config.yaml
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
187
188
189
190
191
192
193
194
195
196
197
198
# Configuration-file for pre-commit
#
# References:
# - Official docs: https://pre-commit.com
# - for more hooks: https://pre-commit.com/hooks.html
# - https://github.com/pre-commit/pre-commit-hooks
#
# Notes:
# - To avoid duplication, we try to configure the tools in pyproject.toml as much as possible.
# - The setting "language: system" is used to run commands that are already available on your system,
# and pre-commit does not need to create or manage an isolated environment.
# - Single-quote regular expressions.
#
# Usage:
# > bin/pre-commit install
# > bin/pre-commit install hooks -f
# > bin/pre-commit autoupdate
# > bin/pre-commit run --all-files
default_install_hook_types: [commit-msg, pre-commit]
default_stages: [pre-commit, manual]
default_language_version:
python: python3.10
fail_fast: true
repos:
# - repo: https://github.com/pre-commit/pygrep-hooks
# rev: v1.10.0
# hooks:
# - id: python-check-mock-methods
# - id: python-use-type-annotations
# - id: rst-backticks
# - id: rst-directive-colons
# - id: rst-inline-touching-normal
# - id: text-unicode-replacement-char
- repo: local
hooks:
# The following are all pre-commit-hooks
# docs: https://github.com/pre-commit/pre-commit-hooks
# - id: lower-case-only
# name: check filenames are lower-case
# entry: check forbidden filenames
# language: fail
# files: '[^a-z0-9._/-]'
- id: check-added-large-files
name: check added large files
entry: check-added-large-files
language: system
- id: check-case-conflict
name: check case conflicts
description: Check for files with names that would conflict on a case-insensitive filesystem.
entry: check-case-conflict
language: system
- id: check-merge-conflict
name: check merge conflict
entry: check-merge-conflict
args: [--assume-in-merge]
language: system
- id: check-shebang-scripts-are-executable
name: check shebang scripts are executable
entry: check-shebang-scripts-are-executable
language: system
- id: check-json
name: check json
entry: check-json
language: system
types: [json]
exclude: '^.vscode/.*\.json'
- id: check-toml
name: check toml syntax
entry: check-toml
language: system
types: [toml]
- id: check-xml
name: check xml syntax
entry: check-xml
language: system
types: [xml]
- id: check-yaml
name: check yaml syntax
entry: check-yaml
language: system
types: [yaml]
- id: check-symlinks
name: check symlinks
entry: check-symlinks
language: system
- id: destroyed-symlinks
name: destroyed symlinks
entry: destroyed-symlinks
language: system
- id: detect-private-key
name: detect private key
entry: detect-private-key
language: system
- id: fix-byte-order-marker
name: fix byte order marker
entry: fix-byte-order-marker
language: system
- id: mixed-line-ending
name: fix mixed line ending (CLRF/LF)
entry: mixed-line-ending
language: system
types: [text]
- id: trailing-whitespace
name: fix trailing whitespace (EOL)
entry: trailing-whitespace-fixer
language: system
types: [text]
# Below python-specific checks
- id: check-ast
name: check ast
entry: check-ast
language: system
types: [python]
- id: check-builtin-literals
name: check builtin literals
entry: check-builtin-literals
language: system
types: [python]
- id: check-docstring-first
name: check docstring first
entry: check-docstring-first
language: system
types: [python]
- id: debug-statements
name: check debug statements
entry: debug-statement-hook
language: system
types: [python]
- id: end-of-file-fixer
name: fix end of files (EOF)
entry: end-of-file-fixer
language: system
types: [python]
- id: fix-encoding-pragma
name: fix encoding pragma
entry: fix-encoding-pragma --remove
language: system
types: [python]
- id: name-tests-test
name: pytests are prefixed tests_*.py
entry: name-tests-test
args: [--pytest-test-first]
language: system
types: [python]
files: '^tests/.*\.py$'
exclude: '^tests/_helpers/.*\.py$'
- id: ruff-format
name: ruff format
entry: ruff format
language: system
types: [python]
- id: ruff-check
name: ruff check
entry: ruff check
args: [--fix]
language: system
types: [python]
- id: uv-lock-check
name: uv lock check
description: check uv.lock is in sync
entry: uv lock --check
language: system
pass_filenames: false