| merge_base_with = "origin/main" |
| |
| [[linter]] |
| code = 'FLAKE8' |
| include_patterns = ['**/*.py'] |
| exclude_patterns = [ |
| 'third-party/**', |
| '**/third-party/**', |
| '.github/scripts/**', |
| 'exir/serde/**', |
| ] |
| command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'flake8_linter', |
| '--', |
| '@{{PATHSFILE}}' |
| ] |
| init_command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'pip_init', |
| '--dry-run={{DRYRUN}}', |
| '--requirement=requirements-lintrunner.txt', |
| ] |
| |
| # Black + usort |
| [[linter]] |
| code = 'UFMT' |
| include_patterns = [ |
| '**/*.py', |
| '**/*.pyi', |
| ] |
| exclude_patterns = [ |
| 'third-party/**', |
| '**/third-party/**', |
| 'exir/serde/**', |
| ] |
| command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'ufmt_linter', |
| '--', |
| '@{{PATHSFILE}}' |
| ] |
| init_command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'pip_init', |
| '--dry-run={{DRYRUN}}', |
| '--no-black-binary', |
| '--requirement=requirements-lintrunner.txt', |
| ] |
| is_formatter = true |
| |
| #CLANGFORMAT |
| [[linter]] |
| code = 'CLANGFORMAT' |
| include_patterns = [ |
| '**/*.h', |
| '**/*.cpp', |
| ] |
| exclude_patterns = [ |
| 'third-party/**', |
| '**/third-party/**', |
| # NB: Objective-C is not supported |
| 'examples/apple/**', |
| 'examples/demo-apps/apple_ios/**', |
| # File contains @generated |
| 'extension/llm/custom_ops/spinquant/fast_hadamard_transform_special.h', |
| 'extension/llm/custom_ops/spinquant/test/fast_hadamard_transform_special_unstrided_cpu.h', |
| ] |
| 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 |
| |
| [[linter]] |
| code = 'CMAKE' |
| include_patterns = [ |
| "**/*.cmake", |
| "**/*.cmake.in", |
| "**/CMakeLists.txt", |
| ] |
| exclude_patterns = [ |
| 'third-party/**', |
| '**/third-party/**', |
| ] |
| command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'cmake_linter', |
| '--config=.cmakelintrc', |
| '--', |
| '@{{PATHSFILE}}', |
| ] |
| init_command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'pip_init', |
| '--dry-run={{DRYRUN}}', |
| '--requirement=requirements-lintrunner.txt', |
| ] |
| |
| [[linter]] |
| code = 'ETCAPITAL' |
| include_patterns = [ |
| '**/*.py', |
| '**/*.pyi', |
| '**/*.h', |
| '**/*.cpp', |
| '**/*.md', |
| '**/*.rst', |
| ] |
| exclude_patterns = [ |
| 'third-party/**', |
| '**/third-party/**', |
| ] |
| command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'grep_linter', |
| # Exclude "ExecuTorch" pattern within URLs |
| '--pattern= Executorch(?!\\W*(://|\\.[a-z]{2,}))\\W+', |
| '--linter-name=ExecuTorchCapitalization', |
| '--error-name=Incorrect capitalization for ExecuTorch', |
| """--error-description= |
| Please use ExecuTorch with capital T for consistency. |
| https://fburl.com/workplace/nsx6hib2 |
| """, |
| '--', |
| '@{{PATHSFILE}}', |
| ] |
| |
| [[linter]] |
| code = 'NEWLINE' |
| include_patterns = ['**'] |
| exclude_patterns = [ |
| 'third-party/**', |
| '**/third-party/**', |
| '**/*.png', |
| '**/*.webp', |
| '**/*.jpeg', |
| '**/*.mp4', |
| '**/*.pte', |
| '**/*.pth', |
| '**/*.bin', |
| '**/*.patch', |
| '**/*.svg', |
| '**/*.bat', |
| '**/*.jpg', |
| '**/*.jar', |
| '**/*.gif', |
| # File contains @generated |
| 'extension/llm/custom_ops/spinquant/fast_hadamard_transform_special.h', |
| 'extension/llm/custom_ops/spinquant/test/fast_hadamard_transform_special_unstrided_cpu.h', |
| ] |
| command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'newlines_linter', |
| '--', |
| '@{{PATHSFILE}}', |
| ] |
| is_formatter = true |
| |
| [[linter]] |
| code = 'NOSTDINC' |
| include_patterns = [ |
| "**/*.c", |
| "**/*.cpp", |
| "**/*.h", |
| "**/*.hpp", |
| ] |
| exclude_patterns = [ |
| '**/devtools/**', |
| '**/test/**', |
| '**/testing_util/**', |
| '**/third-party/**', |
| 'backends/**', |
| 'devtools/**', |
| 'examples/**', |
| 'extension/**', |
| 'kernels/optimized/**', |
| 'scripts/**', |
| 'third-party/**', |
| 'util/**', |
| ] |
| command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'grep_linter', |
| '--pattern=([^\\S\r\n]*#include\s*<(deque|exception|forward_list|functional|list|map|multimap|multiset|priority_queue|queue|set|stack|string|unordered_map|unordered_multimap|unordered_multiset|unordered_set|vector)>)', |
| '--linter-name=NOSTDINC', |
| '--error-name=Standard C++ container include in core', |
| """--error-description=\ |
| Standard library containers should not be included in ExecuTorch core \ |
| because they may call malloc, which is not allowed in core. \ |
| """, |
| '--', |
| '@{{PATHSFILE}}', |
| ] |
| |
| [[linter]] |
| code = 'NOTORCHINC' |
| include_patterns = [ |
| "**/*.c", |
| "**/*.cpp", |
| "**/*.h", |
| "**/*.hpp", |
| ] |
| exclude_patterns = [ |
| '**/devtools/**', |
| '**/fb/**', |
| '**/test/**', |
| '**/tests/**', |
| '**/testing_util/**', |
| '**/third-party/**', |
| 'backends/**', |
| 'codegen/templates/RegisterDispatchKeyCustomOps.cpp', |
| 'codegen/templates/RegisterSchema.cpp', |
| 'devtools/**', |
| 'examples/**', |
| 'exir/verification/bindings.cpp', |
| 'extension/**', |
| 'kernels/optimized/**', |
| 'runtime/core/exec_aten/**', |
| 'runtime/executor/tensor_parser_aten.cpp', |
| 'scripts/**', |
| 'test/**', |
| 'third-party/**', |
| 'util/**', |
| ] |
| command = [ |
| 'python', |
| '-m', |
| 'lintrunner_adapters', |
| 'run', |
| 'grep_linter', |
| '--pattern=#include\s+[<"](aten/|ATen/|torch/)', |
| '--linter-name=NOTORCHINC', |
| '--error-name=ATen or torch include', |
| """--error-description=\ |
| PyTorch includes in ExecuTorch core are prohibited to prevent \ |
| accidentally breaking core's requirements; please make sure this \ |
| header complies (e.g., no streams/malloc/syscalls) and then include \ |
| a patch to update this linter.\ |
| """, |
| '--', |
| '@{{PATHSFILE}}', |
| ] |