content: # 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 = 'CLANGFORMAT'
  include_patterns = [
      '**/*.h',
      '**/*.cc',
      '**/*.hpp',
      '**/*.cpp',
      '**/*.cuh',
      '**/*.cu',
      '**/*.m',
      '**/*.mm',
  ]
  exclude_patterns = [
      'java/**', # FIXME: Enable clang-format for java
      'onnxruntime/contrib_ops/cuda/bert/tensorrt_fused_multihead_attention/**', # Contains data chunks
      'onnxruntime/contrib_ops/cuda/llm/fpA_intB_gemm/launchers/*.generated.cu', # Generated code
      '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
  