forked from qax-os/goreporter
/
config.go
executable file
·258 lines (230 loc) · 7.97 KB
/
config.go
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
// Copyright 2017 The GoReporter Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package engine
// UnitTest is a struct that contains AvgCover, PackagesTestDetail and
// PackagesRaceDetail. The type of AvgCover MUST string that represents
// the code coverage of the entire project. The type of PackagesTestDetail
// MUST map[string]PackageTest(contains pass-status,code-coverage and time).
// and it has all packages' detail information. PackagesRaceDetail contains
// all packages' race cases.
//
// And the UnitTest contains all packages' result.
type UnitTest struct {
AvgCover string `json:"average_cover"`
PackagesTestDetail map[string]PackageTest `json:"packages_test_detail"`
PackagesRaceDetail map[string][]string `json:"packages_race_detail"`
}
// PackageTest is a struct that contains IsPass, Coverage and Time. The
// type of Time MUST float64.
type PackageTest struct {
IsPass bool `json:"is_pass"`
Coverage string `json:"coverage"`
Time float64 `json:"time"`
}
// Cycloi is a struct that contains Average and Result. The Average is
// one package's cyclo coverage. And Result is the detail cyclo of the package's
// all function.
type Cycloi struct {
Average string
Result []string
}
// Test is a struct that contains Path, Result, Time and Cover. The type of
// Time and Cover MUST float64. And it is just for one package's display.
type Test struct {
Path string
Result int
Time float64
Cover float64
}
// File is a struct that contains Color, CycloVal and CycloInfo. And it is just
// for one file's display. The CycloInfo contains all cyclo detail information.
type File struct {
Color string
CycloVal string
CycloInfo string
}
// Copycode is a struct that contains Files and Path. The type of Path MUST []string
// that contains more than one file path. The Copycode represents some copyed code
// information.
type Copycode struct {
Files string
Path []string
}
// Race is a struct that contains Pkg, Len, Leng and Info. The type of Info MUST
// []string that represents more than one race case. Len is the number of cases.
type Race struct {
Pkg string
Len string
Leng string
Info []string
}
// Simple is a struct that contains Path and Info. The type of Path and Info MUST string.
// The Simple represents one can be simpled code case.
type Simple struct {
Path string
Info string
}
// Interfacer is a struct that contains Path and Info. The type of Path and Info MUST string.
// The Interfacer warns about the usage of types that are more specific than necessary.
type Interfacer struct {
Path string
Info string
}
// Spell is a struct that contains Path and Info. The type of Path and Info MUST string.
// The Spell represents one word is misspelled.
type Spell struct {
Path string
Info string
}
// Scan is a struct that contains Path and Info. The type of Path and Info MUST string.
// The Scan represents one defect case.
type Scan struct {
Path string
Info string
}
// Deadcode is a struct that contains Path and Info. The type of Path and Info MUST string.
// The Deadcode represents one dead code.
type Deadcode struct {
Path string
Info string
}
// Cyclo is a struct that contains Pkg, Size and Info. The type of Info MUST []CycloInfo that represents
// detail information of all function.
type Cyclo struct {
Pkg string
Size int
Info []CycloInfo
}
// CycloInfo is a struct that contains Comp and Info. The type of Comp MUST int that represents
// the cyclo of one function.The CycloInfo represents one cyclo function information.
type CycloInfo struct {
Comp int
Info string
}
// Depth is a struct that contains Pkg, Size and Info. Info is an alias to CycloInfo
type Depth struct {
Pkg string
Size int
Info []DepthInfo
}
type DepthInfo CycloInfo
// CodeTest is a struct that contains Summary and Content. It represents the result data
// of the project unit test.
type CodeTest struct {
Summary struct {
CodeCover float64 `json:"code_cover"`
PackageCover float64 `json:"pkg_cover"`
TotalTime float64 `json:"total_time"`
} `json:"summary"`
Content struct {
Pkg []string `json:"pkg"`
Cover []float64 `json:"cover"`
Time []float64 `json:"time"`
NoTest []string `json:"no_test"`
} `json:"content"`
}
// Item is a struct that contains File and Content. It is the code-based infrastructure.
type Item struct {
File string `json:"rep"`
Content []string `json:"content"`
}
// CodeTest is a struct that contains Summary and Content. It represents the result data
// of the project unit test.
type StyleItem struct {
Label string `json:"label"`
Score int `json:"score"`
Detail []Item `json:"detail"`
filesNum int
issuesNum int
}
// CodeTest is a struct that contains Summary and Content. It represents the result data
// of the project unit test.
type CodeStyle struct {
Summary struct {
IssuesNum int `json:"issue_num"`
FilesNum int `json:"file_num"`
Quality string `json:"quality"`
} `json:"summary"`
Content struct {
GoFmt StyleItem `json:"go_fmt"`
GoVet StyleItem `json:"go_vet"`
GoLint StyleItem `json:"go_lint"`
MissSpell StyleItem `json:"miss_spell"`
} `json:"content"`
}
// CodeTest is a struct that contains Summary and Content. It represents the result data
// of the project unit test.
type CopyItem struct {
Label string `json:"label"`
Score int `json:"score"`
Detail [][]string `json:"detail"`
filesNum int
issuesNum int
}
// CodeTest is a struct that contains Summary and Content. It represents the result data
// of the project unit test.
type CodeOptimization struct {
Summary struct {
IssuesNum int `json:"issue_num"`
FilesNum int `json:"file_num"`
Quality string `json:"quality"`
} `json:"summary"`
Content struct {
DeadCode StyleItem `json:"dead_code"`
SimpleCode StyleItem `json:"simple_code"`
StaticCode StyleItem `json:"static_code"`
CopyCode CopyItem `json:"copy_code"`
InterfacerCode StyleItem `json:"interfacer_code"`
} `json:"content"`
}
// CodeCount is a struct that contains Summary and Content. t represents the code
// statistics of the data, you can understand the project from the perspective
// of the number of lines.
type CodeCount struct {
Summary struct {
LineCount int `json:"line_count"`
CommentCount int `json:"comment_count"`
FunctionCount int `json:"function_count"`
FileCount int `json:"file_count"`
} `json:"summary"`
Content struct {
Pkg []string `json:"pkg"`
PkgLineCount []int `json:"pkg_line_count"`
PkgCommentCount []int `json:"pkg_comment_count"`
PkgFunctionCount []int `json:"pkg_function_count"`
File []string `json:"file"`
FileLineCount []int `json:"file_line_count"`
FileCommentCount []int `json:"file_comment_count"`
FileFunctionCount []int `json:"file_function_count"`
} `json:"content"`
}
// CodeSmellItem is a struct that contains path and cyclo.
type CodeSmellItem struct {
Path string `json:"path"`
Cyclo int `json:"cyclo"`
}
// CodeSmell is a struct that contains Summary and Content. It represents the taste of
// the code data, you can understand the project from the perspective of complexity.
type CodeSmell struct {
Summary struct {
CycloAvg int `json:"cyclo_avg"`
CycloHigh int `json:"cyclo_high"`
CycloGrave int `json:"cyclo_grave"`
} `json:"summary"`
Content struct {
Percentage map[string]int `json:"percentage"`
Pkg []string `json:"pkg"`
Cyclo []int `json:"cyclo"`
List []CodeSmellItem `json:"list"`
} `json:"content"`
}