-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
29 lines (27 loc) · 1.1 KB
/
.pre-commit-config.yaml
File metadata and controls
29 lines (27 loc) · 1.1 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
# Pre-commit hooks 配置
# 安装: uv run pre-commit install (或 make pre-commit 运行检查)
# 运行: uv run pre-commit run --all-files
repos:
# Ruff - 现代化的 Python linter 和 formatter (替代 black + isort + flake8)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
# Ruff linter - 代码检查和自动修复
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
# Ruff formatter - 代码格式化 (替代 black)
- id: ruff-format
# 基础检查
- 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 语法
args: ['--unsafe']
- id: check-added-large-files # 防止提交大文件
args: ['--maxkb=1000']
- id: check-merge-conflict # 检查合并冲突标记
- id: check-toml # 检查 TOML 语法
- id: mixed-line-ending # 统一行尾格式
args: ['--fix=lf']