forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
241 lines (222 loc) · 8.01 KB
/
.pre-commit-config.yaml
File metadata and controls
241 lines (222 loc) · 8.01 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
exclude: |
(?x)^(
python/ray/core/generated/|
python/ray/serve/generated/|
python/ray/cloudpickle/|
python/ray/dashboard/client/public/|
python/ray/tests/test_cli_patterns|
python/ray/_private/runtime_env/_clonevirtualenv.py|
python/ray/data/examples/data/|
release/release_logs/|
rllib/offline/tests/data|
thirdparty/patches/|
src/ray/thirdparty/|
doc/external/|
doc/source/
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- id: check-ast
exclude: |
(?x)(
python/ray/serve/tests/test_config_files/syntax_error\.py
)$
- id: check-json
exclude: |
(?x)^(
# Intentionally bad json schema
python/ray/tests/unit/test_runtime_env_validation_bad_schema.json
)
- id: check-toml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff
args: [ --select, "I", --fix, --exit-non-zero-on-fix ]
- repo: https://github.com/jsh9/pydoclint
rev: "0.8.3"
hooks:
- id: pydoclint
args: [
--style=google,
--baseline=ci/lint/pydoclint-baseline.txt,
--exclude=thirdparty|^python/ray/serve/tests/test_config_files/syntax_error\.py$|^python/ray/_private/parameter\.py$,
# --generate-baseline=True, # Not generally needed, but documenting since this is how we generate the initial baseline
--auto-regenerate-baseline=True,
# Current settings (not because we think they're right, but because we
# don't want a baseline the size of the codebase)
--arg-type-hints-in-docstring=False,
--skip-checking-raises=True,
--check-return-types=False,
--allow-init-docstring=True,
--check-class-attributes=False,
# --check-style-mismatch=True, # Bring this back once things are a bit cleaner
]
types: [python]
files: '^python/ray/'
- repo: https://github.com/cpplint/cpplint
rev: 2.0.0
hooks:
- id: cpplint
args: ["--filter=-whitespace/braces,-whitespace/line_length,-build/c++11,-build/c++14,-build/c++17,-readability/braces,-whitespace/indent_namespace,-runtime/int,-runtime/references,-build/include_order"]
files: ^src/ray/(gcs/actor|common/cgroup2|common/scheduling|common/ray_syncer|common/test|util|raylet_client|internal|scheduling|pubsub|object_manager|rpc(?:/.*)?|raylet|core_worker|ipc)/.*\.(h|cc)$
exclude: |
(?x)^(
src/ray/raylet/scheduling/.*\.(h|cc)$ |
src/ray/core_worker/lib/java/.*\.h$
)
- repo: https://github.com/keith/pre-commit-buildifier
rev: 8.0.1
hooks:
- id: buildifier
files: ^(src|cpp|python|rllib|ci|release|java)(/[^/]+)*/BUILD(\.bazel)?$|^BUILD.bazel$
- id: buildifier-lint
files: ^(src|cpp|python|rllib|ci|release|java)(/[^/]+)*/BUILD(\.bazel)?$|^BUILD.bazel$
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
exclude: |
(?x)^(
python/ray/cloudpickle/|
python/build/|
python/ray/core/src/ray/gcs/|
python/ray/thirdparty_files/|
python/ray/_private/thirdparty/|
python/ray/serve/tests/test_config_files/syntax_error\.py|
python/ray/serve/_private/benchmarks/streaming/_grpc/test_server_pb2_grpc\.py|
doc/external/
)
types_or: [python]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
files: 'doc/'
types_or: [javascript, ts, tsx, html, css]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.0
hooks:
- id: mypy
args: ['--follow-imports=skip', '--ignore-missing-imports']
files: |
(?x)^(
python/ray/autoscaler/node_provider.py|
python/ray/autoscaler/sdk/__init__.py|
python/ray/autoscaler/sdk/sdk.py|
python/ray/autoscaler/_private/commands.py|
python/ray/autoscaler/_private/autoscaler.py|
python/ray/_private/gcs_utils.py|
python/ray/serve/handle.py|
python/ray/serve/tests/typing_files/check_handle_typing.py
)
additional_dependencies:
[
types-PyYAML==6.0.12.2,
]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: python-no-log-warn
- id: python-check-mock-methods
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.1
hooks:
- id: shellcheck
args: ['--exclude=1090,1091,2207']
# 1090: Can't follow non-constant source. Use a directive to specify location.
# 1091: Not following {file} due to some error
# 2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). -- these aren't compatible with macOS's old Bash
- repo: https://github.com/pre-commit/mirrors-clang-format
# `rev` specifies a tag on the above repo that mirrors the corresponding clang-format version.
rev: v12.0.1
hooks:
- id: clang-format
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.11.0
hooks:
- id: pretty-format-java
args: [--autofix, --google-java-formatter-version=1.7]
exclude: |
(?x)^(
java/api/src/main/java/io/ray/api/ActorCall.java|
java/api/src/main/java/io/ray/api/CppActorCall.java|
java/api/src/main/java/io/ray/api/PyActorCall.java|
java/api/src/main/java/io/ray/api/RayCall.java
)
- repo: local
hooks:
- id: docstyle
name: Check for Ray docstyle violations
entry: ci/lint/check-docstyle.sh
language: system
types: [python]
- repo: https://github.com/semgrep/pre-commit
rev: v1.32.0
hooks:
- id: semgrep
args: [--config=semgrep.yml, --error]
- repo: https://github.com/errata-ai/vale
rev: v3.4.1
hooks:
- id: vale
files: ^doc/source/data/.*\.(md|rst)$
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.18.1
hooks:
- id: cython-lint
args: [--no-pycodestyle]
- repo: local
hooks:
- id: check-import-order
name: Check for Ray import order violations
entry: python ci/lint/check_import_order.py
language: python
types: [python]
pass_filenames: false
args: [".", "-s", "ci", "-s", "python/ray/thirdparty_files", "-s", "python/build", "-s", "lib"]
- repo: local
hooks:
- id: check-cpp-files-inclusion
name: Check ray core C++ files inclusion violations
entry: ci/lint/check_cpp_files_inclusion.py
language: python
files: '^src/ray/'
types: [c++]
- repo: local
hooks:
- id: check-train-circular-imports
name: Check Ray Train circular imports
entry: python python/ray/train/lint/check_circular_imports.py
language: system
types: [python]
files: '^python/ray/train/.*\.py$'
pass_filenames: false
args: ["--patch_dir", "ray/train/v2"]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.26.0
hooks:
- id: eslint
files: ^python/ray/dashboard/client/src/.*\.(tsx|ts)$
types: [file]
args:
- --max-warnings=0
additional_dependencies:
- eslint@8.26.0
- eslint-plugin-react@7.31.10
- eslint-plugin-import@2.26.0
- eslint-config-react-app@7.0.1
- eslint-plugin-prefer-arrow@1.2.3
- '@typescript-eslint/parser@5.41.0'
- '@typescript-eslint/eslint-plugin@5.41.0'
- '@typescript-eslint/parser@5.41.0'
- '@typescript-eslint/eslint-plugin@5.41.0'