-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
44 lines (41 loc) · 1.3 KB
/
.pre-commit-config.yaml
File metadata and controls
44 lines (41 loc) · 1.3 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
# Pre-commit 配置文件
# 安装: uv pip install pre-commit && pre-commit install
# 手动运行: pre-commit run --all-files
repos:
# Ruff - Python linter 和 formatter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
hooks:
# Ruff linter
- id: ruff
args: [--fix]
types_or: [python, pyi]
# Ruff formatter
- id: ruff-format
types_or: [python, pyi]
# 基础文件检查
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# 检查文件末尾是否有换行符
- id: end-of-file-fixer
# 删除行尾空白
- id: trailing-whitespace
# 检查 YAML 文件语法
- id: check-yaml
# 检查 TOML 文件语法
- id: check-toml
# 检查是否有大文件被提交
- id: check-added-large-files
args: [--maxkb=1000]
# 检查合并冲突标记
- id: check-merge-conflict
# 检查 Python 文件语法
- id: check-ast
# 可选: mypy 类型检查 (如果需要严格类型检查)
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.13.0
# hooks:
# - id: mypy
# additional_dependencies: [types-all]
# args: [--ignore-missing-imports, --no-strict-optional]