forked from TencentBlueKing/blueking-paas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
89 lines (87 loc) · 3 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
fail_fast: true
repos:
- repo: local
hooks:
- id: Name check
name: Check sensitive info
verbose: true
language: system
require_serial: true
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
require_serial: true
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
- id: isort
name: isort
# Set language to disable pre-commit's virtual-env
language: system
types: [python]
exclude: >
(?x)^(
.*/node_modules/.*
| apiserver/paasng/assets/.*
| .*/migrations/.*
| .*/paasng/platform/mgrlegacy/data/.*
| .*/tests/platform/mgrlegacy/assets/.*
)$
entry: poetry run isort --settings-path=pyproject.toml
- id: black
name: black
# Set language to disable pre-commit's virtual-env
language: system
types: [python]
exclude: >
(?x)^(
.*/node_modules/.*
| apiserver/paasng/assets/.*
| .*/migrations/.*
| .*/paasng/platform/mgrlegacy/data/.*
| .*/tests/platform/mgrlegacy/assets/.*
)$
entry: poetry run black --config=pyproject.toml
- id: flake8
name: flak8
language: system
types: [python]
exclude: >
(?x)^(
.*/node_modules/.*
| apiserver/paasng/assets/.*
| .*/migrations/.*
| .*/paasng/platform/mgrlegacy/data/.*
| .*/tests/platform/mgrlegacy/assets/.*
)$
entry: poetry run pflake8 --config=pyproject.toml
# mypy hooks for each Python project, the hooks must be separated because different
# project might use their own configurations
- id: mypy-apiserver
name: run mypy check for "apiserver"
language: system
types: [python]
pass_filenames: false
entry: bash -c "cd apiserver && poetry run mypy . --config-file=./mypy.ini"
files: '^apiserver/'
- id: mypy-workloads
name: run mypy check for "workloads"
# language: python
language: system
types: [python]
pass_filenames: false
entry: bash -c "cd workloads && poetry run python -m mypy . --config-file=./mypy.ini"
files: '^workloads/'
# Disable this hook temporarily because is may results EOF error and loss
# of changes.
# - id: operator-fmt
# language: system
# name: run make fmt for "operator"
# entry: bash -c "cd operator && make fmt"
# files: '^operator/'
- id: operator-lint
language: system
name: run make lint for "operator"
entry: bash -c "cd operator && make lint"
files: '^operator/'