-
Notifications
You must be signed in to change notification settings - Fork 0
/
.lintrunner.toml
255 lines (248 loc) · 4.86 KB
/
.lintrunner.toml
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# Configuration for lintrunner https://github.com/suo/lintrunner
# You can install the dependencies and initialize with
#
# ```sh
# pip install lintrunner lintrunner-adapters
# lintrunner init
# ```
#
# This will install lintrunner on your system and download all the necessary
# dependencies to run linters locally.
# If you want to see what lintrunner init will install, run
# `lintrunner init --dry-run`.
#
# To lint local changes:
#
# ```bash
# lintrunner
# ```
#
# To lint all files:
#
# ```bash
# lintrunner --all-files
# ```
#
# To format files:
#
# ```bash
# lintrunner -a
# ```
#
# To read more about lintrunner, see [wiki](https://github.com/pytorch/pytorch/wiki/lintrunner).
# To update an existing linting rule or create a new one, modify this file or create a
# new adapter following examples in https://github.com/justinchuby/lintrunner-adapters.
merge_base_with = 'main'
[[linter]]
code = 'RUFF'
include_patterns = [
'**/*.py',
'**/*.pyi',
]
exclude_patterns = [
'*_pb2*',
'.setuptools-cmake-build/*',
'docs/**',
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'ruff_linter',
'--config=pyproject.toml',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-lintrunner.txt',
]
is_formatter = true
[[linter]]
code = 'MYPY'
include_patterns = [
'onnx/**/*.py',
'tools/**/*.py',
]
exclude_patterns = [
'onnx/backend/test/**',
'onnx/reference/ops/**', # FIXME: Enable this once typing is fixed
'onnx/test/parser_test.py',
'onnx/test/numpy_helper_test.py',
'onnx/reference/reference_evaluator.py',
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'mypy_linter',
'--config=pyproject.toml',
'--show-disable',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-lintrunner.txt',
]
[[linter]]
code = 'BLACK-ISORT'
include_patterns = [
'**/*.py',
]
exclude_patterns = [
'*_pb2*',
'.setuptools-cmake-build/*',
'cmake/**',
'docs/**',
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'black_isort_linter',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-lintrunner.txt',
]
is_formatter = true
[[linter]]
code = 'NAMESPACE'
include_patterns = ['**/*.cc', '**/*.h']
exclude_patterns = ['third_party/**']
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'grep_linter',
'--pattern=namespace onnx|onnx::',
'--linter-name=NAMESPACE',
'--error-name=hardcoded onnx namespace',
"""--error-description=\
Do not hardcode onnx's namespace in the c++ source code, so that \
other libraries that statically link with onnx can hide onnx symbols \
in a private namespace.\
""",
'--',
'@{{PATHSFILE}}'
]
[[linter]]
code = 'CLANGFORMAT'
include_patterns = [
'onnx/**/*.h',
'onnx/**/*.cc',
]
exclude_patterns = [
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'clangformat_linter',
'--binary=clang-format',
'--fallback',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-lintrunner.txt',
]
is_formatter = true
[[linter]]
code = 'PYLINT'
include_patterns = [
'onnx/**/*.py',
'tools/**/*.py',
]
exclude_patterns = [
'onnx/backend/test/**',
'onnx/backend/sample/ops/abs.py', # redefined-builtin
'onnx/checker.py',
'tools/protoc-gen-mypy.py',
'onnx/test/basic_test.py',
'onnx/test/parser_test.py',
'onnx/test/version_converter_test.py',
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pylint_linter',
'--rcfile=pyproject_pylint.toml',
'--show-disable',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-lintrunner.txt',
]
[[linter]]
code = 'EDITORCONFIG-CHECKER'
include_patterns=[
'**/*.py',
'**/*.pyi',
'**/*.cc',
'**/*.h',
'**/*.md',
'**/*.cpp',
]
exclude_patterns = [
'*_pb2*',
'.setuptools-cmake-build/*',
'cmake/**',
'docs/**',
'community/sc-election-guidelines.md',
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'editorconfig_checker_linter',
'--',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements-lintrunner.txt',
]