mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
Use ruff as the code formatter in place of black and isort since it is much faster, and as projects like PyTorch and ONNX have adopted ruff format as well. This PR include only auto-fixed changes in formatting.
153 lines
3.6 KiB
TOML
153 lines
3.6 KiB
TOML
# Configuration for lintrunner https://github.com/suo/lintrunner
|
|
# You can install the dependencies and initialize with
|
|
#
|
|
# ```sh
|
|
# pip install -r requirements-lintrunner.txt
|
|
# lintrunner init
|
|
# ```
|
|
#
|
|
# This will install lintrunner on your system and download all the necessary
|
|
# dependencies to run linters locally.
|
|
#
|
|
# To format local changes:
|
|
#
|
|
# ```bash
|
|
# lintrunner -a
|
|
# ```
|
|
#
|
|
# To format all files:
|
|
#
|
|
# ```bash
|
|
# lintrunner -a --all-files
|
|
# ```
|
|
#
|
|
# 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 = 'origin/main'
|
|
|
|
[[linter]]
|
|
code = 'RUFF'
|
|
include_patterns = [
|
|
'**/*.py',
|
|
'**/*.pyi',
|
|
]
|
|
exclude_patterns = [
|
|
'cmake/external/**',
|
|
# ignore generated flatbuffers code
|
|
'onnxruntime/core/flatbuffers/ort_flatbuffers_py/**',
|
|
'orttraining/orttraining/python/training/optim/_ds_code_store.py',
|
|
]
|
|
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 = 'RUFF-FORMAT'
|
|
include_patterns = [
|
|
'**/*.py',
|
|
]
|
|
exclude_patterns = [
|
|
'cmake/**',
|
|
'orttraining/*',
|
|
'onnxruntime/core/flatbuffers/**',
|
|
'orttraining/orttraining/python/training/optim/_ds_code_store.py',
|
|
]
|
|
command = [
|
|
'python',
|
|
'-m',
|
|
'lintrunner_adapters',
|
|
'run',
|
|
'ruff_format_linter',
|
|
'--',
|
|
'@{{PATHSFILE}}'
|
|
]
|
|
init_command = [
|
|
'python',
|
|
'-m',
|
|
'lintrunner_adapters',
|
|
'run',
|
|
'pip_init',
|
|
'--dry-run={{DRYRUN}}',
|
|
'--requirement=requirements-lintrunner.txt',
|
|
]
|
|
is_formatter = true
|
|
|
|
[[linter]]
|
|
code = 'RUSTFMT'
|
|
include_patterns = ['**/*.rs']
|
|
command = [
|
|
'python',
|
|
'-m',
|
|
'lintrunner_adapters',
|
|
'run',
|
|
'rustfmt_linter',
|
|
'--binary=rustfmt',
|
|
'--config-path=rust/rustfmt.toml',
|
|
'--',
|
|
'@{{PATHSFILE}}'
|
|
]
|
|
is_formatter = true
|
|
|
|
[[linter]]
|
|
code = 'CLANGFORMAT'
|
|
include_patterns = [
|
|
'**/*.h',
|
|
'**/*.cc',
|
|
'**/*.hpp',
|
|
'**/*.cpp',
|
|
'**/*.m',
|
|
'**/*.mm',
|
|
]
|
|
exclude_patterns = [
|
|
'java/**', # FIXME: Enable clang-format for java
|
|
'onnxruntime/contrib_ops/cuda/bert/tensorrt_fused_multihead_attention/**', # Contains data chunks
|
|
'onnxruntime/core/flatbuffers/schema/*.fbs.h', # Generated code
|
|
'onnxruntime/test/flatbuffers/*.fbs.h', # Generated code
|
|
'onnxruntime/core/graph/contrib_ops/quantization_defs.cc',
|
|
'onnxruntime/core/mlas/**', # Contains assembly code
|
|
'onnxruntime/core/mickey/cutlass_ext/**', # CUTLASS based libs recommends NO automatic code formatting
|
|
'onnxruntime/core/mickey/gemm/**', # CUTLASS based libs recommends NO automatic code formatting
|
|
'winml/lib/Api.Image/shaders/**', # Contains data chunks
|
|
'onnxruntime/contrib_ops/cuda/bert/flash_attention/flash_fwd_launch_template.h', # Bool Switches hang Clang
|
|
'onnxruntime/core/providers/coreml/mlprogram_test_scripts/**', # test scripts only
|
|
]
|
|
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
|