-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
96 lines (88 loc) · 2.44 KB
/
.pre-commit-config.yaml
File metadata and controls
96 lines (88 loc) · 2.44 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
repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v8.0.0
hooks:
- id: commitlint
stages: [ commit-msg ]
additional_dependencies:
- "@commitlint/config-conventional"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-executables-have-shebangs
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
types: [ python ]
# 排除可能需要特殊格式的文件
exclude: |
(?x)(
tests/.*\.txt|
.*\.md
)
- id: trailing-whitespace
# 排除 Markdown 文件(可能需要尾部空格实现换行)
exclude: |
(?x)(
.*\.md|
tests/.*\.txt
)
- id: requirements-txt-fixer
# auto-walrus: 自动转换为海象运算符可能降低可读性,建议按需启用
# - repo: https://github.com/MarcoGorelli/auto-walrus
# rev: 0.3.4
# hooks:
# - id: auto-walrus
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.11
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:
- tomli
# 排除容易误报的文件类型
exclude: |
(?x)(
tests/.*|
.*\.json|
.*\.lock|
.*\.min\..*
)
# 添加常见技术术语到忽略列表
args: ['--ignore-words-list=crate,damon,fo,hist,iff,som,sur,tim']
# 设置为警告模式,不阻止提交
verbose: true
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "v2.6.0"
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.24.1
hooks:
- id: validate-pyproject
# 本地检查
- repo: local
hooks:
# 提交前检查敏感 IP 信息
- id: ip
name: Check ip
description: Check ip
entry: python3 scripts/sensitive_info_check/check_ip.py
language: system
# 扩大排除范围,避免误报
exclude: |
(?x)(
tests/.*\.py|
.*_test\.py|
test_.*\.py|
examples/.*|
docs/.*|
.*\.md|
.*\.lock|
.*\.json
)