-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
241 lines (203 loc) · 8.11 KB
/
.pre-commit-config.yaml
File metadata and controls
241 lines (203 loc) · 8.11 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# Apply to all files without committing:
# pre-commit run --all-files
# Update this file:
# pre-commit autoupdate
default_language_version:
# force all unspecified python hooks to run python3
python: python3
# https://pre-commit.ci/
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: monthly
submodules: false
# https://pre-commit.com/#pre-commit-configyaml---top-level
exclude: |
(?x)(
.github/|
)
# pre-commit setup
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# Identify invalid files
- id: check-ast
name: check-ast (Python)
description: Check for syntax errors in Python files.
# git checks
- id: check-merge-conflict
name: Check for merge conflict strings
description: Check for files that contain merge conflict strings.
- id: check-added-large-files
name: Check for large files
description: Check for large files that were added to the repository.
args:
- --maxkb=2000
- id: detect-private-key
name: Detect private key
description: Check for private keys in the repository.
- id: check-case-conflict
name: Check for case conflicts
description: Check for files with names that differ only in case.
# Python checks
- id: check-docstring-first
name: Check for docstring in first line
description: Check that the first line of a file is a docstring.
- id: debug-statements
name: Check for debug statements
description: Check for print statements and pdb imports.
- id: requirements-txt-fixer
name: Fix requirements.txt
description: Fix the formatting of requirements.txt files.
- id: fix-byte-order-marker
name: Fix byte order marker
description: Fix the byte order marker in Python files.
- id: check-builtin-literals
name: Check for built-in literals
description: Check for built-in literals in Python code.
# General quality checks
- id: mixed-line-ending
name: Mixed line ending
description: Check for mixed line endings.
args:
- --fix=lf
- id: trailing-whitespace
name: Trailing whitespace
description: Check for trailing whitespace.
args:
- --markdown-linebreak-ext=md
- id: check-executables-have-shebangs
name: Check for shebangs in executables
description: Check that executables have shebangs.
- id: end-of-file-fixer
name: End of file fixer
description: Ensure that files end with a newline.
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa # Enforce that noqa annotations always occur with specific codes. Sample annotations: # noqa: F401, # noqa: F401,W203
name: Check for blanket noqa
description: Check for blanket noqa annotations.
- id: python-check-blanket-type-ignore # Enforce that # type: ignore annotations always occur with specific codes. Sample annotations: # type: ignore[attr-defined], # type: ignore[attr-defined, name-defined]
name: Check for blanket type ignore
description: Check for blanket type ignore annotations.
- id: python-check-mock-methods # Prevent common mistakes of assert mck.not_called(), assert mck.called_once_with(...) and mck.assert_called
name: Check for mock methods
description: Check for common mistakes of mock methods.
- id: python-no-eval # A quick check for the eval() built-in function
name: Check for eval
description: Check for the eval() built-in function.
- id: python-no-log-warn # A quick check for the deprecated .warn() method of python loggers
name: Check for log warn
description: Check for the deprecated .warn() method of python loggers.
- id: python-use-type-annotations # Enforce that python3.6+ type annotations are used instead of type comments
name: Use type annotations
description: Enforce that python3.6+ type annotations are used instead of type comments.
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 3.6.1
hooks:
- id: editorconfig-checker
name: EditorConfig Checker
description: Check for compliance with the definitions in the EditorConfig file.
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
name: PyUpgrade
description: Upgrade syntax to newer versions of Python.
args:
- --py310-plus # Minimum required Python version for EVE-Alert. Update as needed.
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
name: Flake8
description: Check for style and complexity issues in Python code.
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
name: YesQA
description: Check for extraneous `# noqa` comments.
exclude: '^main\.py$'
- repo: https://github.com/PyCQA/isort
rev: 9.0.0a3
hooks:
- id: isort
name: Isort
description: Sort imports.
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker/
rev: v1.1.3
hooks:
- id: black-disable-checker
name: Black disable checker
description: Check for black disable comments.
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.5.1
hooks:
- id: black
name: Black
description: Format Python code.
args:
- --target-version=py310 # Minimum required Python version for EVE-Alert. Update as needed.
- repo: https://github.com/asottile/blacken-docs
rev: 1.20.0
hooks:
- id: blacken-docs
name: Blacken docs
description: Format Python code in documentation files.
additional_dependencies:
- black==25.9.0 # https://github.com/psf/black/releases/latest
args:
- --target-version=py310 # Minimum required Python version for EVE-Alert. Update as needed.
- repo: https://github.com/executablebooks/mdformat
rev: 1.0.0
hooks:
- id: mdformat
name: Mdformat
description: Format Markdown files.
additional_dependencies:
- mdformat-gfm==1.0.0 # Mdformat plugin for GitHub Flavored Markdown compatibility » https://github.com/hukkin/mdformat-gfm/tags
- mdformat-toc==0.5.0 # Mdformat plugin to generate a table of contents » https://github.com/hukkin/mdformat-toc/tags
- mdformat-black==0.1.1 # Mdformat plugin to Blacken Python code blocks » https://github.com/hukkin/mdformat-black/tags
- mdformat-shfmt==0.2.0 # Mdformat plugin to format shell code blocks » https://github.com/hukkin/mdformat-shfmt/tags
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.23.0
hooks:
- id: pyproject-fmt
name: pyproject.toml formatter
description: Format the pyproject.toml file.
args:
- --indent=4
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.25
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
description: Validate the pyproject.toml file.
- repo: https://github.com/pylint-dev/pylint
rev: v4.0.5
hooks:
- id: pylint
name: Pylint
description: Check for errors and code smells in Python code.
args:
- --py-version=3.10
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
hooks:
- id: check-github-actions
name: Check GitHub Actions
description: This hook checks that GitHub Actions files are valid.
args:
- --verbose
- id: check-github-workflows
name: Check GitHub Workflows
description: This hook checks that GitHub Workflows files are valid.
args:
- --verbose