-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
117 lines (107 loc) · 3.51 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
117 lines (107 loc) · 3.51 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
minimum_pre_commit_version: 4.0.0
exclude: ^(LICENSES/|test/)|\.(html|csv|svg|md|yaml)$|^examples/.*.json$
default_stages: [pre-commit]
ci:
autofix_prs: false
autoupdate_schedule: monthly
repos:
# pre-commit 基础检查
- repo: https://gitcode.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: ["--allow-multiple-documents"]
exclude: |
(?i)python/msprobe/pytorch/dump/api_dump/support_wrap_ops\.yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: detect-private-key
- id: check-json
# -------------------------- Python 核心检查 --------------------------
# Ruff:指定读取 pre-commit/pyproject.toml
- repo: https://gitcode.com/gh_mirrors/ru/ruff-pre-commit
rev: v0.14.14
hooks:
- id: ruff-check
args: ["--config", "pre-commit/pyproject.toml", "--output-format", "github", "--fix"]
types: [python]
exclude: ^test/
- id: ruff-format
args: ["--config", "pre-commit/pyproject.toml"]
types: [python]
exclude: ^test/
# codespell
- repo: https://gitcode.com/gh_mirrors/co/codespell
rev: v2.4.1
hooks:
- id: codespell
args: [
"-L",
"CANN,cann,NNAL,nnal,ASCEND,ascend,EnQue,CopyIn,ArchType,AND,ND,tbe,copyin,alog",
"--skip",
"*.py,*.cpp,*.hpp,*.c,*.h,pre-commit/typos.toml,*/package-lock.json",
]
# pylint:指定 pre-commit/pyproject.toml
- repo: https://gitcode.com/gh_mirrors/pyl/pylint
rev: v4.0.5
hooks:
- id: pylint
name: pylint (Python code quality check)
types: [python]
args: ["--rcfile=pre-commit/pyproject.toml", "--ignore-paths=^test/"]
verbose: false
# Bandit:指定 pre-commit/pyproject.toml
- repo: https://gitcode.com/gh_mirrors/ba/bandit
rev: 1.9.4
hooks:
- id: bandit
name: bandit (Python 安全漏洞检查)
types: [python]
args: [
"--config=pre-commit/pyproject.toml",
"--quiet",
]
# typos
- repo: https://gitcode.com/gh_mirrors/ty/typos
rev: v1.32.0
hooks:
- id: typos
args: ["--force-exclude", "--config", "pre-commit/typos.toml"]
#--------------- C++ 核心检查 ---------------------------------------------
- repo: https://gitcode.com/pre-commit-clang/mirrors-clang-format
rev: v18.1.8
hooks:
- id: clang-format
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx)$
args:
- "--style={BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 120, BreakBeforeBraces: Allman}"
- "--verbose"
- "-i"
exclude: ^(build/|test/|tests/third_party/)
# -------------------------- Gitleaks 本地离线二进制扫描 --------------------------
- repo: local
hooks:
- id: gitleaks-offline-scan
name: Gitleaks Secret Scan(Local Binary)
entry: ./gitleaks
language: system
pass_filenames: true
args:
- protect
- --verbose
- --redact
- --config=pre-commit/.gitleaks.toml
stages: [pre-commit]
# --------------- C++ 静态检查(本地 clang-tidy)------------------
- repo: local
hooks:
- id: clang-tidy
name: clang-tidy (本地venv)
entry: clang-tidy
language: system
pass_filenames: true
files: ^csrc/.+\.(c|h|cpp|hpp|cc|hh|cxx|hxx)$
args:
- "--config-file=.clang-tidy"