-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmodel.go
More file actions
73 lines (62 loc) · 2.87 KB
/
model.go
File metadata and controls
73 lines (62 loc) · 2.87 KB
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
package main
import "sonar-webhook/sdks/sonar"
//-----------------------------------
// 请求参数
//-----------------------------------
// RobotWebhookParameters 机器人回掉请求参数
type RobotWebhookParameters struct {
Key string `json:"key" form:"key" binding:"required"` // 访问密钥
SonarToken string `json:"sonarToken" form:"sonarToken"` // SonarQue认证密钥
SkipSuccess bool `json:"skipSuccess" form:"skipSuccess"` // 是否跳过质量门成功
NewCode bool `json:"newCode" form:"newCode"` // 是否显示新代码指标
}
// WeComMessageParameters 机器人回掉请求参数
type WeComMessageParameters struct {
WeComConfig
SonarToken string `json:"sonarToken" form:"sonarToken"` // SonarQue认证密钥
SkipSuccess bool `json:"skipSuccess" form:"skipSuccess"` // 是否跳过质量门成功
NewCode bool `json:"newCode" form:"newCode"` // 是否显示新代码指标
}
type WeComConfig struct {
CorpId string `json:"corpId" form:"corpId" binding:"required"` // 企业id
CorpSecret string `json:"corpSecret" form:"corpSecret" binding:"required"` // 企业密钥
AgentId int `json:"agentId" form:"agentId" binding:"required"` // 应用id
}
// FeiShuMessageParameters 回调请求飞书消息参数
type FeiShuMessageParameters struct {
FeiShuConfig
SonarToken string `json:"sonarToken" form:"sonarToken"` // SonarQue认证密钥
SkipSuccess bool `json:"skipSuccess" form:"skipSuccess"` // 是否跳过质量门成功
NewCode bool `json:"newCode" form:"newCode"` // 是否显示新代码指标
}
type FeiShuConfig struct {
AppId string `json:"appId" form:"appId" binding:"required"` // 应用ID
AppSecret string `json:"appSecret" form:"appSecret" binding:"required"` // 应用密钥
}
//-----------------------------------
// 模版消息上下文
//-----------------------------------
// MessageBuildArgs 消息构建参数
type MessageBuildArgs struct {
WebhookData *sonar.WebhookData
SonarToken string
NewCode bool
}
// MessageTemplateData 消息模板上下问数据
type MessageTemplateData struct {
AnalysisResult string // 质量门结果
Url string // 结果访问url
WebhookData *sonar.WebhookData // webhook回调数据
MeasuresComponent *sonar.MeasuresComponent // 项目分支指标数据(原始数据)
Measure *MeasuresData // 项目分支指标数据
}
type MeasuresData struct {
Bugs string // Bugs数
Vulnerabilities string // 漏洞数
CodeSmells string // 异味数
DuplicatedLinesDensity string // 代码行重复率
ReliabilityRating string // 可维护性
SecurityRating string // 安全评级
SqaleRating string // Sqale评级
Coverage string // 单元测试覆盖率
}