forked from microsoft/MLOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
175 lines (169 loc) · 5.15 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
# Enable automatic updates via Github Actions as well.
# See https://pre-commit.ci
ci:
# Let pre-commit.ci automatically update PRs with formatting fixes.
autofix_prs: true
# skip local hooks - they should be managed manually via conda-envs/*.yml
skip: [mypy, pylint, pycodestyle, pyright]
autoupdate_schedule: monthly
autoupdate_commit_msg: |
[pre-commit.ci] pre-commit autoupdate
for more information, see https://pre-commit.ci
NOTE: Be sure to also check for other possible hook updates in the conda-envs/*.yml files (e.g., mypy, pylint, etc.).
See Also:
- https://github.com/microsoft/MLOS/blob/main/conda-envs/mlos.yml
- https://pypi.org/project/mypy/
- https://pypi.org/project/pyright/
- https://pypi.org/project/pylint/
- https://pypi.org/project/pycodestyle/
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [pre-commit]
# Note "require_serial" actually controls whether that particular hook's files
# are partitioned and the hook executable called in parallel across them, not
# whether hooks themselves are parallelized.
# As such, some hooks (e.g., pylint) which do internal parallelism need it set
# for efficiency and correctness anyways.
repos:
#
# Formatting
#
# NOTE: checks that adjust files are marked with the special "manual" stage so
# that we can easily call them via `make`.
#
#
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
# - id: check-executables-have-shebangs (issues in devcontainer)
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
stages: [pre-commit, manual]
- id: trailing-whitespace
stages: [pre-commit, manual]
- repo: https://gitlab.com/bmares/check-json5
rev: v1.0.0
hooks:
- id: check-json5
alias: check-json
types_or: [file, json]
files: '\.json[c]?$'
# FIXME: This removes comments.
# See Also: https://github.com/dpranke/pyjson5/issues/28
#- repo: https://github.com/whtsky/pre-commit-pretty-format-json5
# rev: "1.0.0"
# hooks:
# - id: pretty-format-json5
# alias: pretty-format-json
# args: [--no-sort-keys]
# stages: [pre-commit, manual]
# types_or: [file, json]
# files: '\.json[c]?$'
- repo: https://github.com/johann-petrak/licenseheaders
rev: v0.8.8
hooks:
- id: licenseheaders
files: '\.(sh|cmd|ps1|sql|py)$'
args: [-t, doc/mit-license.tmpl, -E, .py, .sh, .ps1, .sql, .cmd, -x, mlos_bench/setup.py, mlos_core/setup.py, mlos_viz/setup.py, -f]
stages: [pre-commit, manual]
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py310-plus]
stages: [pre-commit, manual]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
require_serial: true
args: ["-j", "-1"]
stages: [pre-commit, manual]
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
stages: [pre-commit, manual]
- repo: https://github.com/PyCQA/docformatter
rev: 06907d0 # v1.7.5
hooks:
- id: docformatter
stages: [pre-commit, manual]
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat-black
- mdformat_frontmatter
- mdformat-toc
#
# Linting
#
- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
types: [python]
additional_dependencies:
- tomli
# Use pylint and mypy from the local (conda) environment so that vscode can reuse them too.
- repo: local
hooks:
- id: pycodestyle
name: pycodestyle
entry: pycodestyle
language: system
types: [python]
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
require_serial: true
args: [
"-j0",
"--rcfile=pyproject.toml",
"-rn", # Only display messages
"-sn", # Don't display the score
]
exclude: |
(?x)^(
doc/source/conf.py
)$
- id: pyright
name: pyright
entry: pyright
language: system
types: [python]
require_serial: true
exclude: |
(?x)^(
doc/source/conf.py|
mlos_core/setup.py|
mlos_bench/setup.py|
mlos_viz/setup.py|
conftest.py
)$
- id: mypy
name: mypy
entry: mypy
language: system
types: [python]
require_serial: true
exclude: |
(?x)^(
doc/source/conf.py|
mlos_core/setup.py|
mlos_bench/setup.py|
mlos_viz/setup.py|
conftest.py
)$
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes