forked from bytedance/Dolphin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
34 lines (31 loc) · 1.12 KB
/
.pre-commit-config.yaml
File metadata and controls
34 lines (31 loc) · 1.12 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
repos:
# 1. isort - 自动排序 Python imports
- repo: https://github.com/pycqa/isort
rev: 6.0.1 # 使用固定版本号
hooks:
- id: isort
name: isort (python)
args: [--profile=black] # 与 Black 兼容的配置
language: python
# 2. Black - 自动格式化 Python 代码
- repo: https://github.com/psf/black
rev: 25.1.0 # 使用固定版本号
hooks:
- id: black
language: python
# 3. flake8 - Python 静态检查
- repo: https://github.com/pycqa/flake8
rev: 7.2.0
hooks:
- id: flake8
args: [--max-line-length=120, --ignore=E203] # 设置行长度为 120
additional_dependencies: [flake8-bugbear==24.12.12] # 可选:增强检查
# 4. pre-commit-hooks - 通用 Git 钩子
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace # 删除行尾空格
- id: end-of-file-fixer # 确保文件以换行符结束
- id: check-yaml # 验证 YAML 文件语法
- id: check-added-large-files # 阻止大文件提交
args: ["--maxkb=512"]