已合并
[sync] PR-35086: Disable CLANGTIDY and Modify pyproject.toml #35117
ascend-robot创建于 5月9日
[sync] PR-35086: Disable CLANGTIDY and Modify pyproject.toml #35117
已合并
ascend-robot创建于 5月9日
2 个文件变更+212-198
@@ -150,160 +150,160 @@ command = [
150 '--config=pyrefly.toml',150 '--config=pyrefly.toml',
151]151]
152 152 
153-[[linter]]153+# [[linter]]
154-code = 'CLANGTIDY'154+# code = 'CLANGTIDY'
155-include_patterns = [155+# include_patterns = [
156- # Enable coverage of headers in aten/src/ATen156+# # Enable coverage of headers in aten/src/ATen
157- # and excluding most sub-directories for now.157+# # and excluding most sub-directories for now.
158- 'aten/src/ATen/*.h',158+# 'aten/src/ATen/*.h',
159- 'aten/src/ATen/*.cpp',159+# 'aten/src/ATen/*.cpp',
160- 'aten/src/ATen/cuda/*.cpp',160+# 'aten/src/ATen/cuda/*.cpp',
161- 'aten/src/ATen/cpu/*.h',161+# 'aten/src/ATen/cpu/*.h',
162- 'aten/src/ATen/cpu/*.cpp',162+# 'aten/src/ATen/cpu/*.cpp',
163- 'aten/src/ATen/accelerator/**/*.h',163+# 'aten/src/ATen/accelerator/**/*.h',
164- 'aten/src/ATen/accelerator/**/*.cpp',164+# 'aten/src/ATen/accelerator/**/*.cpp',
165- 'aten/src/ATen/core/*.h',165+# 'aten/src/ATen/core/*.h',
166- 'aten/src/ATen/core/*.cpp',166+# 'aten/src/ATen/core/*.cpp',
167- 'aten/src/ATen/cudnn/*.h',167+# 'aten/src/ATen/cudnn/*.h',
168- 'aten/src/ATen/cudnn/*.cpp',168+# 'aten/src/ATen/cudnn/*.cpp',
169- 'aten/src/ATen/native/mkldnn/xpu/**/*.h',169+# 'aten/src/ATen/native/mkldnn/xpu/**/*.h',
170- 'aten/src/ATen/native/mkldnn/xpu/**/*.cpp',170+# 'aten/src/ATen/native/mkldnn/xpu/**/*.cpp',
171- 'aten/src/ATen/detail/*',171+# 'aten/src/ATen/detail/*',
172- 'aten/src/ATen/functorch/*.h',172+# 'aten/src/ATen/functorch/*.h',
173- 'aten/src/ATen/functorch/*.cpp',173+# 'aten/src/ATen/functorch/*.cpp',
174- 'aten/src/ATen/native/nested/cuda/*.cpp',174+# 'aten/src/ATen/native/nested/cuda/*.cpp',
175- 'aten/src/ATen/native/nested/cuda/*.h',175+# 'aten/src/ATen/native/nested/cuda/*.h',
176- 'aten/src/ATen/native/nested/*.cpp',176+# 'aten/src/ATen/native/nested/*.cpp',
177- 'aten/src/ATen/native/nested/*.h',177+# 'aten/src/ATen/native/nested/*.h',
178- 'aten/src/ATen/xpu/**/*.h',178+# 'aten/src/ATen/xpu/**/*.h',
179- 'aten/src/ATen/xpu/**/*.cpp',179+# 'aten/src/ATen/xpu/**/*.cpp',
180- 'c10/**/*.cpp',180+# 'c10/**/*.cpp',
181- 'c10/**/*.h',181+# 'c10/**/*.h',
182- 'torch_npu/*.h',182+# 'torch_npu/*.h',
183- 'torch_npu/_inductor/codegen/aoti_runtime/*.h',183+# 'torch_npu/_inductor/codegen/aoti_runtime/*.h',
184- 'torch_npu/_inductor/codegen/aoti_runtime/*.cpp',184+# 'torch_npu/_inductor/codegen/aoti_runtime/*.cpp',
185- 'torch_npu/csrc/*.h',185+# 'torch_npu/csrc/*.h',
186- 'torch_npu/csrc/*.cpp',186+# 'torch_npu/csrc/*.cpp',
187- 'torch_npu/csrc/**/*.h',187+# 'torch_npu/csrc/**/*.h',
188- 'torch_npu/csrc/**/*.cpp',188+# 'torch_npu/csrc/**/*.cpp',
189- 'torch_npu/csrc/jit/serialization/*.h',189+# 'torch_npu/csrc/jit/serialization/*.h',
190- 'torch_npu/csrc/jit/serialization/*.cpp',190+# 'torch_npu/csrc/jit/serialization/*.cpp',
191- 'torch_npu/nativert/*.h',191+# 'torch_npu/nativert/*.h',
192- 'torch_npu/nativert/*.cpp',192+# 'torch_npu/nativert/*.cpp',
193- 'torch_npu/nativert/**/*.h',193+# 'torch_npu/nativert/**/*.h',
194- 'torch_npu/nativert/**/*.cpp',194+# 'torch_npu/nativert/**/*.cpp',
195- 'torch_npu/headeronly/**/*.h',195+# 'torch_npu/headeronly/**/*.h',
196-]196+# ]
197-exclude_patterns = [197+# exclude_patterns = [
198- # The negative filters below are to exclude files that include onnx_pb.h or198+# # The negative filters below are to exclude files that include onnx_pb.h or
199- # caffe2_pb.h, otherwise we'd have to build protos as part of this CI job.199+# # caffe2_pb.h, otherwise we'd have to build protos as part of this CI job.
200- # CUDA files are also excluded.200+# # CUDA files are also excluded.
201- '**/fb/**',201+# '**/fb/**',
202- '**/generated/**',202+# '**/generated/**',
203- '**/*pb.h',203+# '**/*pb.h',
204- '**/*inl.h',204+# '**/*inl.h',
205- 'aten/src/ATen/cpu/FlushDenormal.cpp',205+# 'aten/src/ATen/cpu/FlushDenormal.cpp',
206- 'aten/src/ATen/cpu/vml.h',206+# 'aten/src/ATen/cpu/vml.h',
207- 'aten/src/ATen/CPUFixedAllocator.h',207+# 'aten/src/ATen/CPUFixedAllocator.h',
208- 'aten/src/ATen/Parallel*.h',208+# 'aten/src/ATen/Parallel*.h',
209- 'c10/xpu/**/*.h',209+# 'c10/xpu/**/*.h',
210- 'c10/xpu/**/*.cpp',210+# 'c10/xpu/**/*.cpp',
211- 'c10/benchmark/intrusive_ptr_benchmark.cpp',211+# 'c10/benchmark/intrusive_ptr_benchmark.cpp',
212- 'c10/cuda/CUDAAlgorithm.h',212+# 'c10/cuda/CUDAAlgorithm.h',
213- 'c10/util/complex_math.h',213+# 'c10/util/complex_math.h',
214- 'c10/util/complex_utils.h',214+# 'c10/util/complex_utils.h',
215- 'c10/util/flat_hash_map.h',215+# 'c10/util/flat_hash_map.h',
216- 'c10/util/logging*.h',216+# 'c10/util/logging*.h',
217- 'c10/metal/*.h',217+# 'c10/metal/*.h',
218- 'c10/util/hash.h',218+# 'c10/util/hash.h',
219- 'c10/util/strong_type.h',219+# 'c10/util/strong_type.h',
220- 'c10/util/SmallVector.h',220+# 'c10/util/SmallVector.h',
221- 'c10/util/win32-headers.h',221+# 'c10/util/win32-headers.h',
222- 'c10/test/**/*.h',222+# 'c10/test/**/*.h',
223- 'c10/test/**/*.cpp',223+# 'c10/test/**/*.cpp',
224- 'third_party/**/*',224+# 'third_party/**/*',
225- 'torch_npu/csrc/autograd/generated/**',225+# 'torch_npu/csrc/autograd/generated/**',
226- 'torch_npu/csrc/distributed/**/*.cu',226+# 'torch_npu/csrc/distributed/**/*.cu',
227- 'torch_npu/csrc/distributed/c10d/WinSockUtils.hpp',227+# 'torch_npu/csrc/distributed/c10d/WinSockUtils.hpp',
228- 'torch_npu/csrc/distributed/c10d/quantization/quantization_gpu.h',228+# 'torch_npu/csrc/distributed/c10d/quantization/quantization_gpu.h',
229- 'torch_npu/csrc/dynamo/eval_frame.h',229+# 'torch_npu/csrc/dynamo/eval_frame.h',
230- 'torch_npu/csrc/inductor/aoti_torch/c/shim.h',230+# 'torch_npu/csrc/inductor/aoti_torch/c/shim.h',
231- 'torch_npu/csrc/jit/**/*',231+# 'torch_npu/csrc/jit/**/*',
232- 'torch_npu/csrc/jit/serialization/mobile_bytecode_generated.h',232+# 'torch_npu/csrc/jit/serialization/mobile_bytecode_generated.h',
233- 'torch_npu/csrc/utils/generated_serialization_types.h',233+# 'torch_npu/csrc/utils/generated_serialization_types.h',
234- 'torch_npu/csrc/utils/pythoncapi_compat.h',234+# 'torch_npu/csrc/utils/pythoncapi_compat.h',
235- 'torch_npu/csrc/inductor/aoti_runtime/sycl_runtime_wrappers.h',235+# 'torch_npu/csrc/inductor/aoti_runtime/sycl_runtime_wrappers.h',
236-]236+# ]
237-init_command = [237+# init_command = [
238- 'python3',238+# 'python3',
239- 'tools/linter/adapters/s3_init.py',239+# 'tools/linter/adapters/s3_init.py',
240- '--config-json=tools/linter/adapters/s3_init_config.json',240+# '--config-json=tools/linter/adapters/s3_init_config.json',
241- '--linter=clang-tidy',241+# '--linter=clang-tidy',
242- '--dry-run={{DRYRUN}}',242+# '--dry-run={{DRYRUN}}',
243- '--output-dir=.lintbin',243+# '--output-dir=.lintbin',
244- '--output-name=clang-tidy',244+# '--output-name=clang-tidy',
245-]245+# ]
246-command = [246+# command = [
247- 'python3',247+# 'python3',
248- 'tools/linter/adapters/clangtidy_linter.py',248+# 'tools/linter/adapters/clangtidy_linter.py',
249- '--binary=.lintbin/clang-tidy',249+# '--binary=.lintbin/clang-tidy',
250- '--build_dir=./build',250+# '--build_dir=./build',
251- '--',251+# '--',
252- '@{{PATHSFILE}}'252+# '@{{PATHSFILE}}'
253-]253+# ]
254 254 
255-[[linter]]255+# [[linter]]
256-code = 'CLANGTIDY_EXECUTORCH_COMPATIBILITY'256+# code = 'CLANGTIDY_EXECUTORCH_COMPATIBILITY'
257-include_patterns = [257+# include_patterns = [
258- # c10 headers that must be C++17 compatible258+# # c10 headers that must be C++17 compatible
259- 'c10/macros/Export.h',259+# 'c10/macros/Export.h',
260- 'c10/macros/Macros.h',260+# 'c10/macros/Macros.h',
261- 'c10/macros/cmake_macros.h',261+# 'c10/macros/cmake_macros.h',
262- 'c10/util/BFloat16.h',262+# 'c10/util/BFloat16.h',
263- 'c10/util/BFloat16-inl.h',263+# 'c10/util/BFloat16-inl.h',
264- 'c10/util/BFloat16-math.h',264+# 'c10/util/BFloat16-math.h',
265- 'c10/util/Half.h',265+# 'c10/util/Half.h',
266- 'c10/util/Half-inl.h',266+# 'c10/util/Half-inl.h',
267- 'c10/util/TypeSafeSignMath.h',267+# 'c10/util/TypeSafeSignMath.h',
268- 'c10/util/bit_cast.h',268+# 'c10/util/bit_cast.h',
269- 'c10/util/complex.h',269+# 'c10/util/complex.h',
270- 'c10/util/floating_point_utils.h',270+# 'c10/util/floating_point_utils.h',
271- 'c10/util/irange.h',271+# 'c10/util/irange.h',
272- 'c10/util/llvmMathExtras.h',272+# 'c10/util/llvmMathExtras.h',
273- 'c10/util/overflows.h',273+# 'c10/util/overflows.h',
274- 'c10/util/safe_numerics.h',274+# 'c10/util/safe_numerics.h',
275- # torch_npu/headeronly headers that must be C++17 compatible275+# # torch_npu/headeronly headers that must be C++17 compatible
276- 'torch_npu/headeronly/macros/cmake_macros.h',276+# 'torch_npu/headeronly/macros/cmake_macros.h',
277- 'torch_npu/headeronly/macros/Export.h',277+# 'torch_npu/headeronly/macros/Export.h',
278- 'torch_npu/headeronly/macros/Macros.h',278+# 'torch_npu/headeronly/macros/Macros.h',
279- 'torch_npu/headeronly/util/BFloat16.h',279+# 'torch_npu/headeronly/util/BFloat16.h',
280- 'torch_npu/headeronly/util/Half.h',280+# 'torch_npu/headeronly/util/Half.h',
281- 'torch_npu/headeronly/util/TypeSafeSignMath.h',281+# 'torch_npu/headeronly/util/TypeSafeSignMath.h',
282- 'torch_npu/headeronly/util/bit_cast.h',282+# 'torch_npu/headeronly/util/bit_cast.h',
283- 'torch_npu/headeronly/util/complex.h',283+# 'torch_npu/headeronly/util/complex.h',
284- 'torch_npu/headeronly/util/floating_point_utils.h',284+# 'torch_npu/headeronly/util/floating_point_utils.h',
285-]285+# ]
286-exclude_patterns = [286+# exclude_patterns = [
287- '**/fb/**',287+# '**/fb/**',
288-]288+# ]
289-init_command = [289+# init_command = [
290- 'python3',290+# 'python3',
291- 'tools/linter/adapters/s3_init.py',291+# 'tools/linter/adapters/s3_init.py',
292- '--config-json=tools/linter/adapters/s3_init_config.json',292+# '--config-json=tools/linter/adapters/s3_init_config.json',
293- '--linter=clang-tidy',293+# '--linter=clang-tidy',
294- '--dry-run={{DRYRUN}}',294+# '--dry-run={{DRYRUN}}',
295- '--output-dir=.lintbin',295+# '--output-dir=.lintbin',
296- '--output-name=clang-tidy',296+# '--output-name=clang-tidy',
297-]297+# ]
298-command = [298+# command = [
299- 'python3',299+# 'python3',
300- 'tools/linter/adapters/clangtidy_linter.py',300+# 'tools/linter/adapters/clangtidy_linter.py',
301- '--binary=.lintbin/clang-tidy',301+# '--binary=.lintbin/clang-tidy',
302- '--build_dir=./build',302+# '--build_dir=./build',
303- '--std=c++17',303+# '--std=c++17',
304- '--',304+# '--',
305- '@{{PATHSFILE}}'305+# '@{{PATHSFILE}}'
306-]306+# ]
307 307 
308[[linter]]308[[linter]]
309code = 'TYPEIGNORE'309code = 'TYPEIGNORE'
@@ -16,7 +16,7 @@ dynamic = [
16# Linter tools #################################################################16# Linter tools #################################################################
17 17 
18[tool.isort]18[tool.isort]
19-src_paths = ["caffe2", "torch", "torchgen", "functorch", "test"]19+src_paths = ["torch_npu", "torchnpugen", "test"]
20extra_standard_library = ["typing_extensions"]20extra_standard_library = ["typing_extensions"]
21skip_gitignore = true21skip_gitignore = true
22skip_glob = ["third_party/*"]22skip_glob = ["third_party/*"]
@@ -34,12 +34,12 @@ preserve_inline_comments = true
34collapse_blank_lines_in_category = false34collapse_blank_lines_in_category = false
35 35 
36[tool.usort.known]36[tool.usort.known]
37-first_party = ["caffe2", "torch", "torchgen", "functorch", "test"]37+first_party = ["torch_npu", "torchnpugen", "test"]
38standard_library = ["typing_extensions"]38standard_library = ["typing_extensions"]
39 39 
40[tool.ruff]40[tool.ruff]
41line-length = 8841line-length = 88
42-src = ["caffe2", "torch", "torchgen", "functorch", "test"]42+src = ["torch_npu", "torchnpugen", "test"]
43extend-exclude = ["third_party", "test/dynamo/cpython"]43extend-exclude = ["third_party", "test/dynamo/cpython"]
44 44 
45[tool.ruff.per-file-target-version]45[tool.ruff.per-file-target-version]
@@ -190,25 +190,31 @@ select = [
190 "PYI021", # docstring-in-stub190 "PYI021", # docstring-in-stub
191 "PYI053", # string-or-bytes-too-long191 "PYI053", # string-or-bytes-too-long
192]192]
193-"functorch/docs/source/tutorials/**" = [193+# upstream community path (not present in torch_npu)
194- "F401",194+# "functorch/docs/source/tutorials/**" = [
195-]195+# "F401",
196-"test/export/**" = [196+# ]
197- "PGH004",197+# upstream community path (not present in torch_npu)
198-]198+# "test/export/**" = [
199-"test/typing/**" = [199+# "PGH004",
200- "PGH004"200+# ]
201-]201+# upstream community path (not present in torch_npu)
202-"test/typing/reveal/**" = [202+# "test/typing/**" = [
203- "F821",203+# "PGH004"
204-]204+# ]
205-"test/torch_np/numpy_tests/**" = [205+# upstream community path (not present in torch_npu)
206- "F821",206+# "test/typing/reveal/**" = [
207- "NPY201",207+# "F821",
208-]208+# ]
209-"test/dynamo/test_bytecode_utils.py" = [209+# upstream community path (not present in torch_npu)
210- "F821",210+# "test/torch_np/numpy_tests/**" = [
211-]211+# "F821",
212+# "NPY201",
213+# ]
214+# upstream community path (not present in torch_npu)
215+# "test/dynamo/test_bytecode_utils.py" = [
216+# "F821",
217+# ]
212"test/dynamo/test_debug_utils.py" = [218"test/dynamo/test_debug_utils.py" = [
213 "UP037",219 "UP037",
214]220]
@@ -227,45 +233,53 @@ select = [
227 "RUF015",233 "RUF015",
228 "UP", # We don't want to modify the jit test as they test specify syntax234 "UP", # We don't want to modify the jit test as they test specify syntax
229]235]
230-"test/inductor/s429861_repro.py" = [236+"test/**" = ["S101"]
231- "PGH004",237+# upstream community path (not present in torch_npu)
232-]238+# "test/inductor/s429861_repro.py" = [
233-"test/inductor/test_torchinductor.py" = [239+# "PGH004",
234- "UP037",240+# ]
235-]241+# upstream community path (not present in torch_npu)
242+# "test/inductor/test_torchinductor.py" = [
243+# "UP037",
244+# ]
236# autogenerated #TODO figure out why file level noqa is ignored245# autogenerated #TODO figure out why file level noqa is ignored
237-"torch/_appdirs.py" = ["PGH004"]246+# upstream community paths (not present in torch_npu)
238-"torch/jit/_shape_functions.py" = ["PGH004"]247+# "torch/_appdirs.py" = ["PGH004"]
239-"torch/_inductor/fx_passes/serialized_patterns/**" = ["F401", "F501"]248+# "torch/jit/_shape_functions.py" = ["PGH004"]
240-"torch/_inductor/autoheuristic/artifacts/**" = ["F401", "F501"]249+# "torch/_inductor/fx_passes/serialized_patterns/**" = ["F401", "F501"]
241-"torch/_inductor/codegen/**" = [250+# "torch/_inductor/autoheuristic/artifacts/**" = ["F401", "F501"]
251+"torch_npu/_inductor/codegen/**" = [
242 "PGH004"252 "PGH004"
243]253]
244-"torchgen/api/types/__init__.py" = [254+# upstream community path (not present in torch_npu)
245- "F401",255+# "torchgen/api/types/__init__.py" = [
246- "F403",256+# "F401",
247-]257+# "F403",
248-"torch/utils/collect_env.py" = [258+# ]
259+"torch_npu/utils/collect_env.py" = [
249 "UP", # collect_env.py needs to work with older versions of Python260 "UP", # collect_env.py needs to work with older versions of Python
250]261]
251-"torch/_vendor/**" = [262+# upstream community path (not present in torch_npu)
252- "UP", # No need to mess with _vendor263+# "torch/_vendor/**" = [
253-]264+# "UP", # No need to mess with _vendor
265+# ]
254"tools/linter/**" = [266"tools/linter/**" = [
255 "LOG015" # please fix267 "LOG015" # please fix
256]268]
257 269 
258-# torch/ folders still needing S101 migration270+# torch_npu/ folders still needing S101 migration
259-"torch/_dynamo/**" = ["S101"]271+# upstream community path (not present in torch_npu)
260-"torch/_inductor/**" = ["S101"]272+# "torch/_dynamo/**" = ["S101"]
273+"torch_npu/_inductor/**" = ["S101"]
261 274 
262[tool.codespell]275[tool.codespell]
263ignore-words = "tools/linter/dictionary.txt"276ignore-words = "tools/linter/dictionary.txt"
264 277 
265[tool.spin]278[tool.spin]
266-package = 'torch'279+package = 'torch_npu'
267 280 
268[tool.spin.commands]281[tool.spin.commands]
282+# upstream community paths (`.spin/cmds.py` not present in torch_npu)
269"Build" = [283"Build" = [
270 ".spin/cmds.py:lint",284 ".spin/cmds.py:lint",
271 ".spin/cmds.py:fixlint",285 ".spin/cmds.py:fixlint",