-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
51 lines (46 loc) · 1.29 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
51 lines (46 loc) · 1.29 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
# Pre-commit hooks 配置
# 安装: pip install pre-commit && pre-commit install
repos:
# Black 代码格式化
- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
args: ['--line-length=100']
language_version: python3
# isort 导入排序
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: ['--profile=black', '--line-length=100']
# flake8 代码检查
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
args: ['--max-line-length=100', '--extend-ignore=E501,W503,E402,E203']
additional_dependencies:
- flake8-bugbear
# 标准 hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-merge-conflict
- id: detect-private-key
# 本地 hooks
- repo: local
hooks:
# 检查硬编码路径(跨平台兼容性)
- id: check-hardcoded-paths
name: Check for hardcoded Unix paths
entry: python scripts/check_paths.py
language: python
files: \.py$
pass_filenames: true