onnxruntime
/
.lintrunner.toml
161 строка · 3.7 Кб
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 f --all-files
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
36merge_base_with = 'origin/main'
37
38[[linter]]
39code = 'RUFF'
40include_patterns = [
41'**/*.py',
42'**/*.pyi',
43]
44exclude_patterns = [
45'cmake/external/**',
46# ignore generated flatbuffers code
47'onnxruntime/core/flatbuffers/ort_flatbuffers_py/**',
48'orttraining/orttraining/python/training/optim/_ds_code_store.py',
49]
50command = [
51'python',
52'-m',
53'lintrunner_adapters',
54'run',
55'ruff_linter',
56'--config=pyproject.toml',
57'@{{PATHSFILE}}'
58]
59init_command = [
60'python',
61'-m',
62'lintrunner_adapters',
63'run',
64'pip_init',
65'--dry-run={{DRYRUN}}',
66'--requirement=requirements-lintrunner.txt',
67]
68is_formatter = true
69
70
71[[linter]]
72code = 'BLACK-ISORT'
73include_patterns = [
74'**/*.py',
75]
76exclude_patterns = [
77'cmake/**',
78'orttraining/*',
79'onnxruntime/core/flatbuffers/**',
80'orttraining/orttraining/python/training/optim/_ds_code_store.py',
81]
82command = [
83'python',
84'-m',
85'lintrunner_adapters',
86'run',
87'black_isort_linter',
88'--',
89'@{{PATHSFILE}}'
90]
91init_command = [
92'python',
93'-m',
94'lintrunner_adapters',
95'run',
96'pip_init',
97'--dry-run={{DRYRUN}}',
98'--requirement=requirements-lintrunner.txt',
99]
100is_formatter = true
101
102[[linter]]
103code = 'RUSTFMT'
104include_patterns = ['**/*.rs']
105command = [
106'python',
107'-m',
108'lintrunner_adapters',
109'run',
110'rustfmt_linter',
111'--binary=rustfmt',
112'--config-path=rust/rustfmt.toml',
113'--',
114'@{{PATHSFILE}}'
115]
116is_formatter = true
117
118[[linter]]
119code = 'CLANGFORMAT'
120include_patterns = [
121'**/*.h',
122'**/*.cc',
123'**/*.hpp',
124'**/*.cpp',
125'**/*.m',
126'**/*.mm',
127]
128exclude_patterns = [
129'java/**', # FIXME: Enable clang-format for java
130'onnxruntime/contrib_ops/cuda/bert/tensorrt_fused_multihead_attention/**', # Contains data chunks
131'onnxruntime/core/flatbuffers/schema/*.fbs.h', # Generated code
132'onnxruntime/test/flatbuffers/*.fbs.h', # Generated code
133'onnxruntime/core/graph/contrib_ops/quantization_defs.cc',
134'onnxruntime/core/mlas/**', # Contains assembly code
135'onnxruntime/core/mickey/cutlass_ext/**', # CUTLASS based libs recommends NO automatic code formatting
136'onnxruntime/core/mickey/gemm/**', # CUTLASS based libs recommends NO automatic code formatting
137'winml/lib/Api.Image/shaders/**', # Contains data chunks
138'onnxruntime/contrib_ops/cuda/bert/flash_attention/flash_fwd_launch_template.h', # Bool Switches hang Clang
139'onnxruntime/core/providers/coreml/mlprogram_test_scripts/**', # test scripts only
140]
141command = [
142'python',
143'-m',
144'lintrunner_adapters',
145'run',
146'clangformat_linter',
147'--binary=clang-format',
148'--fallback',
149'--',
150'@{{PATHSFILE}}'
151]
152init_command = [
153'python',
154'-m',
155'lintrunner_adapters',
156'run',
157'pip_init',
158'--dry-run={{DRYRUN}}',
159'--requirement=requirements-lintrunner.txt',
160]
161is_formatter = true
162