forked from TencentBlueKing/bkpaas-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
68 lines (66 loc) · 2.42 KB
/
.pre-commit-config.yaml
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
repos:
- repo: local
hooks:
- id: Name check
name: Check sensitive info
verbose: true
language: system
entry: bash -c "if [[ -d pre_commit_hooks ]]; then pre_commit_hooks/rtx.sh $@; fi"
- id: IP check
name: Check sensitive info
verbose: true
language: system
exclude: "^(.*/poetry.lock|.*/requirements.txt|.*/requirements_dev.txt)|sdks/apigw-manager/build.yml"
entry: bash -c "if [[ -d pre_commit_hooks ]]; then pre_commit_hooks/ip.sh $@; fi"
# See ./pyproject.toml for below tool's version and settings
# 总是使用 --force-exclude 来让 ruff 配置文件中的 exclude 生效
- id: ruff-check-fix
name: ruff-check-fix
language: system
types: [python]
# 修复包导入顺序问题,类似 isort 工具
entry: poetry run ruff check --force-exclude --select I --fix
- id: ruff-format
name: ruff-format
language: system
types: [python]
entry: poetry run ruff format --force-exclude
- id: ruff-check
name: ruff-check
language: system
types: [python]
entry: poetry run ruff check --force-exclude
# mypy hooks for each Python project, the hooks must be separated because different
# project might use their own configurations
- id: mypy-blue_krill
name: run mypy check for "blue-krill'
language: system
types: [python]
pass_filenames: false
entry: bash -c "cd sdks/blue-krill && poetry run mypy . --config-file=./pyproject.toml"
files: '^sdks/blue-krill/'
- id: mypy-paas-service
name: run mypy check for "paas-service'
language: system
types: [python]
pass_filenames: false
entry: bash -c "cd sdks/paas-service && poetry run mypy . --config-file=./pyproject.toml"
files: '^sdks/paas-service/'
# sdk bkapi-client-core
- repo: local
hooks:
- id: mypy
name: run mypy for "bkapi-client-core"
language: python
types: [python]
entry: mypy --config-file=sdks/bkapi-client-core/pyproject.toml
files: sdks/bkapi-client-core/
# sdk apigw-manager
- repo: local
hooks:
- id: mypy
name: run mypy for "apigw-manager"
language: python
types: [python]
entry: mypy --config-file=sdks/apigw-manager/pyproject.toml
files: sdks/apigw-manager/