onnx

Форк
0
/
.lintrunner.toml 
219 строк · 4.2 Кб
1
# Configuration for lintrunner https://github.com/suo/lintrunner
2
# You can install the dependencies and initialize with
3
#
4
# ```sh
5
# pip install lintrunner lintrunner-adapters
6
# lintrunner init
7
# ```
8
#
9
# This will install lintrunner on your system and download all the necessary
10
# dependencies to run linters locally.
11
# If you want to see what lintrunner init will install, run
12
# `lintrunner init --dry-run`.
13
#
14
# To lint local changes:
15
#
16
# ```bash
17
# lintrunner
18
# ```
19
#
20
# To lint all files:
21
#
22
# ```bash
23
# lintrunner --all-files
24
# ```
25
#
26
# To format files:
27
#
28
# ```bash
29
# lintrunner -a
30
# ```
31
#
32
# To read more about lintrunner, see [wiki](https://github.com/pytorch/pytorch/wiki/lintrunner).
33
# To update an existing linting rule or create a new one, modify this file or create a
34
# new adapter following examples in https://github.com/justinchuby/lintrunner-adapters.
35
merge_base_with = 'main'
36

37
[[linter]]
38
code = 'RUFF'
39
include_patterns = [
40
    '**/*.py',
41
    '**/*.pyi',
42
]
43
exclude_patterns = [
44
    '*_pb2*',
45
    '.setuptools-cmake-build/*',
46
    'docs/**',
47
]
48
command = [
49
    'python',
50
    '-m',
51
    'lintrunner_adapters',
52
    'run',
53
    'ruff_linter',
54
    '--config=pyproject.toml',
55
    '@{{PATHSFILE}}'
56
]
57
init_command = [
58
    'python',
59
    '-m',
60
    'lintrunner_adapters',
61
    'run',
62
    'pip_init',
63
    '--dry-run={{DRYRUN}}',
64
    '--requirement=requirements-lintrunner.txt',
65
]
66
is_formatter = true
67

68
[[linter]]
69
code = 'MYPY'
70
include_patterns = [
71
    'onnx/**/*.py',
72
    'tools/**/*.py',
73
]
74
exclude_patterns = [
75
    'onnx/backend/test/**',
76
    'onnx/reference/ops/**',  # FIXME: Enable this once typing is fixed
77
    'onnx/test/parser_test.py',
78
    'onnx/test/numpy_helper_test.py',
79
    'onnx/reference/reference_evaluator.py',
80
]
81
command = [
82
    'python',
83
    '-m',
84
    'lintrunner_adapters',
85
    'run',
86
    'mypy_linter',
87
    '--config=pyproject.toml',
88
    '--show-disable',
89
    '--',
90
    '@{{PATHSFILE}}'
91
]
92
init_command = [
93
    'python',
94
    '-m',
95
    'lintrunner_adapters',
96
    'run',
97
    'pip_init',
98
    '--dry-run={{DRYRUN}}',
99
    '--requirement=requirements-lintrunner.txt',
100
]
101

102
[[linter]]
103
code = 'BLACK-ISORT'
104
include_patterns = [
105
    '**/*.py',
106
]
107
exclude_patterns = [
108
    '*_pb2*',
109
    '.setuptools-cmake-build/*',
110
    'cmake/**',
111
    'docs/**',
112
]
113
command = [
114
    'python',
115
    '-m',
116
    'lintrunner_adapters',
117
    'run',
118
    'black_isort_linter',
119
    '--',
120
    '@{{PATHSFILE}}'
121
]
122
init_command = [
123
    'python',
124
    '-m',
125
    'lintrunner_adapters',
126
    'run',
127
    'pip_init',
128
    '--dry-run={{DRYRUN}}',
129
    '--requirement=requirements-lintrunner.txt',
130
]
131
is_formatter = true
132

133
[[linter]]
134
code = 'NAMESPACE'
135
include_patterns = ['**/*.cc', '**/*.h']
136
exclude_patterns = ['third_party/**']
137
command = [
138
    'python',
139
    '-m',
140
    'lintrunner_adapters',
141
    'run',
142
    'grep_linter',
143
    '--pattern=namespace onnx|onnx::',
144
    '--linter-name=NAMESPACE',
145
    '--error-name=hardcoded onnx namespace',
146
    """--error-description=\
147
        Do not hardcode onnx's namespace in the c++ source code, so that \
148
        other libraries that statically link with onnx can hide onnx symbols \
149
        in a private namespace.\
150
    """,
151
    '--',
152
    '@{{PATHSFILE}}'
153
]
154

155
[[linter]]
156
code = 'CLANGFORMAT'
157
include_patterns = [
158
    'onnx/**/*.h',
159
    'onnx/**/*.cc',
160
]
161
exclude_patterns = [
162
]
163
command = [
164
    'python',
165
    '-m',
166
    'lintrunner_adapters',
167
    'run',
168
    'clangformat_linter',
169
    '--binary=clang-format',
170
    '--fallback',
171
    '--',
172
    '@{{PATHSFILE}}'
173
]
174
init_command = [
175
    'python',
176
    '-m',
177
    'lintrunner_adapters',
178
    'run',
179
    'pip_init',
180
    '--dry-run={{DRYRUN}}',
181
    '--requirement=requirements-lintrunner.txt',
182
]
183
is_formatter = true
184

185
[[linter]]
186
code = 'EDITORCONFIG-CHECKER'
187
include_patterns=[
188
    '**/*.py',
189
    '**/*.pyi',
190
    '**/*.cc',
191
    '**/*.h',
192
    '**/*.md',
193
    '**/*.cpp',
194
]
195
exclude_patterns = [
196
    '*_pb2*',
197
    '.setuptools-cmake-build/*',
198
    'cmake/**',
199
    'docs/**',
200
    'community/sc-election-guidelines.md',
201
]
202
command = [
203
    'python',
204
    '-m',
205
    'lintrunner_adapters',
206
    'run',
207
    'editorconfig_checker_linter',
208
    '--',
209
    '@{{PATHSFILE}}'
210
]
211
init_command = [
212
    'python',
213
    '-m',
214
    'lintrunner_adapters',
215
    'run',
216
    'pip_init',
217
    '--dry-run={{DRYRUN}}',
218
    '--requirement=requirements-lintrunner.txt',
219
]
220

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.