onnx
/
.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.
35merge_base_with = 'main'36
37[[linter]]38code = 'RUFF'39include_patterns = [40'**/*.py',41'**/*.pyi',42]
43exclude_patterns = [44'*_pb2*',45'.setuptools-cmake-build/*',46'docs/**',47]
48command = [49'python',50'-m',51'lintrunner_adapters',52'run',53'ruff_linter',54'--config=pyproject.toml',55'@{{PATHSFILE}}'56]
57init_command = [58'python',59'-m',60'lintrunner_adapters',61'run',62'pip_init',63'--dry-run={{DRYRUN}}',64'--requirement=requirements-lintrunner.txt',65]
66is_formatter = true67
68[[linter]]69code = 'MYPY'70include_patterns = [71'onnx/**/*.py',72'tools/**/*.py',73]
74exclude_patterns = [75'onnx/backend/test/**',76'onnx/reference/ops/**', # FIXME: Enable this once typing is fixed77'onnx/test/parser_test.py',78'onnx/test/numpy_helper_test.py',79'onnx/reference/reference_evaluator.py',80]
81command = [82'python',83'-m',84'lintrunner_adapters',85'run',86'mypy_linter',87'--config=pyproject.toml',88'--show-disable',89'--',90'@{{PATHSFILE}}'91]
92init_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]]103code = 'BLACK-ISORT'104include_patterns = [105'**/*.py',106]
107exclude_patterns = [108'*_pb2*',109'.setuptools-cmake-build/*',110'cmake/**',111'docs/**',112]
113command = [114'python',115'-m',116'lintrunner_adapters',117'run',118'black_isort_linter',119'--',120'@{{PATHSFILE}}'121]
122init_command = [123'python',124'-m',125'lintrunner_adapters',126'run',127'pip_init',128'--dry-run={{DRYRUN}}',129'--requirement=requirements-lintrunner.txt',130]
131is_formatter = true132
133[[linter]]134code = 'NAMESPACE'135include_patterns = ['**/*.cc', '**/*.h']136exclude_patterns = ['third_party/**']137command = [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=\147Do not hardcode onnx's namespace in the c++ source code, so that \
148other libraries that statically link with onnx can hide onnx symbols \
149in a private namespace.\
150""",151'--',152'@{{PATHSFILE}}'153]
154
155[[linter]]156code = 'CLANGFORMAT'157include_patterns = [158'onnx/**/*.h',159'onnx/**/*.cc',160]
161exclude_patterns = [162]
163command = [164'python',165'-m',166'lintrunner_adapters',167'run',168'clangformat_linter',169'--binary=clang-format',170'--fallback',171'--',172'@{{PATHSFILE}}'173]
174init_command = [175'python',176'-m',177'lintrunner_adapters',178'run',179'pip_init',180'--dry-run={{DRYRUN}}',181'--requirement=requirements-lintrunner.txt',182]
183is_formatter = true184
185[[linter]]186code = 'EDITORCONFIG-CHECKER'187include_patterns=[188'**/*.py',189'**/*.pyi',190'**/*.cc',191'**/*.h',192'**/*.md',193'**/*.cpp',194]
195exclude_patterns = [196'*_pb2*',197'.setuptools-cmake-build/*',198'cmake/**',199'docs/**',200'community/sc-election-guidelines.md',201]
202command = [203'python',204'-m',205'lintrunner_adapters',206'run',207'editorconfig_checker_linter',208'--',209'@{{PATHSFILE}}'210]
211init_command = [212'python',213'-m',214'lintrunner_adapters',215'run',216'pip_init',217'--dry-run={{DRYRUN}}',218'--requirement=requirements-lintrunner.txt',219]
220