forked from TencentBlueKing/bk-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
82 lines (74 loc) · 2.12 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
default_stages: [commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
# 检查 merge conflict
- id: check-merge-conflict
# 检查 private key
- id: detect-private-key
# 将代码中的 python2 语法转换为 python3 语法
- repo: https://github.com/asottile/pyupgrade
rev: v1.21.0
hooks:
- id: pyupgrade
# black
- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: black
language_version: python3
args: [--config=pyproject.toml]
# isort
- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
name: isort
additional_dependencies: ["toml"]
args: [--settings-path=pyproject.toml]
# 本地检查
- repo: local
hooks:
# 执行 preci 流水线
- id: check-pre-ci-pipeline
name: check pre ci pipeline
entry: python3 scripts/pre-commit/pre-push.py
language: system
stages: [ push ]
verbose: true
# flake8
- id: flake8
name: flak8
language: python
types: [python]
pass_filenames: true
entry: pflake8 --config=./pyproject.toml
# PreCI 检查
- id: check-pre-ci
name: check pre ci
entry: python3 scripts/pre-commit/preci.py
language: system
verbose: true
# 提交前,需要检查提交 message
- id: check-commit-message
name: Check commit message
entry: python scripts/pre-commit/check_commit_message.py
language: system
stages: [ commit-msg ]
# 提交前检查敏感 IP 信息
- id: ip
name: Check ip
description: Check ip
entry: python3 scripts/sensitive_info_check/check_ip.py
language: system
exclude: |
(?x)(
^scripts/sensitive_info_check/|
requirements.txt$|
bkmonitor/tests/.*.py|
bkmonitor/bin/prom-aggregation-gateway|
bkmonitor/static/monitor/js/main.*|
bklog/version_logs_md/|
bkmonitor/alarm_backends/tests/.*.py
)