forked from TencentBlueKing/blueking-paas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
73 lines (71 loc) · 2.69 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
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"
# 总是使用 --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 --no-cache
- id: ruff-format
name: ruff-format
language: system
types: [python]
entry: poetry run ruff format --force-exclude --no-cache
- id: ruff-check
name: ruff-check
language: system
types: [python]
entry: poetry run ruff check --force-exclude --no-cache
# 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=./pyproject.toml"
files: '^apiserver/'
- id: import-linter-apiserver
name: run import-linter check for "apiserver"
language: system
types: [python]
pass_filenames: false
entry: bash -c "cd apiserver/paasng && poetry run lint-imports"
files: '^apiserver/'
# 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/'
- id: cnb-builder-shim-lint
language: system
name: run make lint for "builder-stack/cnb-builder-shim"
entry: bash -c "cd builder-stack/cnb-builder-shim && make lint"
files: '^builder-stack/cnb-builder-shim/'
- id: kaniko-shim-lint
language: system
name: run make lint for "builder-stack/kaniko-shim"
entry: bash -c "cd builder-stack/kaniko-shim && make lint"
files: '^builder-stack/kaniko-shim/'