forked from TencentBlueKing/bkmonitor-datalink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
70 lines (62 loc) · 2.06 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_stages: [ commit ]
default_install_hook_types: [ pre-commit, commit-msg, pre-push ]
repos:
- repo: local
hooks:
# 提交前,需要检查提交 message
- id: check-commit-message
name: Check commit message
entry: python3 scripts/pre_commit/check_commit_message.py
language: system
stages: [ commit-msg ]
verbose: true
# 执行 preci 流水线
- id: check-pre-ci-pipeline
name: check pre ci pipeline
entry: python3 scripts/pre_commit/pre-push.py
language: system
stages: [ pre-push ]
verbose: true
# 执行 preci 扫描
- id: check-pre-ci-pre-commit
name: check pre ci pre commit
entry: scripts/pre_commit/preci/scan.sh
language: system
verbose: true
# 提交前检查敏感 IP 信息
- id: ip
name: Check ip
description: Check ip
entry: scripts/pre_commit/sensitive_info_check/ip.sh
language: script
verbose: true
files: ""
# 提交前检查文件是否已经带上版权信息头,但是不做强制修改
# go install github.com/google/addlicense@latest
- id: check-license
name: check license header
entry: scripts/pre_commit/check_license.sh
language: script
verbose: true
files: "(.*\\.go|.*\\.sh|.*\\.py)$"
# 提交前执行 gofmt 格式化文件
- id: gofmt
name: go format files
entry: scripts/pre_commit/gofmt.sh
language: script
verbose: true
files: ".*\\.go$"
# goimports-reviser,检查 import 的顺序格式化
- id: goimports-reviser
name: go import checks
entry: scripts/pre_commit/goimport.sh
language: script
verbose: true
files: ".*\\.go"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-merge-conflict
- id: detect-private-key