forked from hw-native-sys/simpler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
103 lines (93 loc) · 3.65 KB
/
.pre-commit-config.yaml
File metadata and controls
103 lines (93 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright (c) PyPTO Contributors.
# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
# CANN Open Software License Agreement Version 2.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# -----------------------------------------------------------------------------------------------------------
repos:
# Common
- repo: local
hooks:
- id: check-headers
name: check-headers
entry: python tests/lint/check_headers.py
language: python
language_version: python3
- id: check-english-only
name: check-english-only
entry: python tests/lint/check_english_only.py
language: python
language_version: python3
exclude: ^(3rdparty/|docs/zh-cn/|README\.zh-CN\.md)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
# C++ linting
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.0
hooks:
- id: clang-format
types_or: [c++, c]
exclude: ^3rdparty/
- repo: local
hooks:
# `language: system` (not `python`) is intentional: clang_tidy.py imports
# simpler_setup, which is the project itself. With `language: python`,
# pre-commit creates an isolated venv that doesn't see the project install
# and the hook fails with ModuleNotFoundError. `system` reuses whatever
# python is on PATH — in CI that's setup-python's interpreter (where
# `pip install .` ran in an earlier step); locally it's the activated
# `.venv` (where `pip install -e .` ran). Pre-installing the project in an
# isolated hook venv would technically work but triggers a full C++ build
# (cmake + ninja + nanobind + build_runtimes for all sim variants) and
# forces every Python-only contributor to install a C++ toolchain.
- id: clang-tidy
name: clang-tidy
entry: python tests/lint/clang_tidy.py
language: system
types_or: [c++, c]
exclude: |
(?x)^(
3rdparty/|
python/bindings/|
.*/kernels/|
.*/aicore/
)
- repo: https://github.com/cpplint/cpplint
rev: 2.0.0
hooks:
- id: cpplint
exclude: ^3rdparty/
args:
- --root=include
- --linelength=120
- --filter=-whitespace,-build,-legal,-runtime,-readability,+readability/todo
# Markdown linting
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.20.0
hooks:
- id: markdownlint-cli2
args:
- --fix
- --config
- tests/lint/.markdownlint.yaml
# Python linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.8
hooks:
- id: ruff-check
types_or: [python, pyi]
args: [--fix]
- id: ruff-format
types_or: [python, pyi]
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.407
hooks:
- id: pyright
additional_dependencies: [pytest==7.0.0]