|
1 | 1 | package engine
|
2 | 2 |
|
3 |
| -import ( |
4 |
| - "html/template" |
5 |
| -) |
6 |
| - |
7 |
| -type Reporter struct { |
8 |
| - Project string `json:"project"` |
9 |
| - Score int `json:"score"` |
10 |
| - UnitTestx UnitTest `json:"unit_test"` |
11 |
| - Cyclox map[string]Cycloi `json:"cyclo"` |
12 |
| - SimpleTips map[string][]string `json:"simple_tips"` |
13 |
| - CopyTips [][]string `json:"copy_tips"` |
14 |
| - ScanTips map[string][]string `json:"scan_tips"` |
15 |
| - DependGraph string `json:"depend_graph"` |
16 |
| - DeadCode []string `json:"dead_code"` |
17 |
| - NoTestPkg []string `json:"no_test_package"` |
18 |
| - SpellError []string `json:"spell_error"` |
19 |
| -} |
20 |
| - |
21 |
| -type UnitTest struct { |
22 |
| - AvgCover string `json:"average_cover"` |
23 |
| - PackagesTestDetail map[string]PackageTest `json:"packages_test_detail"` |
24 |
| - PackagesRaceDetail map[string][]string `json:"packages_race_detail"` |
| 3 | +// Error contains the line number and the reason for |
| 4 | +// an error output from a command |
| 5 | +type Error struct { |
| 6 | + LineNumber int `json:"line_number"` |
| 7 | + ErrorString string `json:"error_string"` |
25 | 8 | }
|
26 | 9 |
|
27 |
| -type PackageTest struct { |
28 |
| - IsPass bool `json:"is_pass"` |
29 |
| - Coverage string `json:"coverage"` |
30 |
| - Time float64 `json:"time"` |
| 10 | +// FileSummary contains the filename, location of the file |
| 11 | +// on GitHub, and all of the errors related to the file |
| 12 | +type Summary struct { |
| 13 | + Name string `json:"name"` |
| 14 | + Description string `json:"description"` |
| 15 | + Errors []Error `json:"errors"` |
31 | 16 | }
|
32 | 17 |
|
33 |
| -type Cycloi struct { |
34 |
| - Average string |
35 |
| - Result []string |
| 18 | +// Metric as template of report and will save all linters result |
| 19 | +// data.But may have some diffreence in diffrent linter. |
| 20 | +type Metric struct { |
| 21 | + Name string `json:"name"` |
| 22 | + Description string `json:"description"` |
| 23 | + Summaries map[string]Summary `json:"summaries"` |
| 24 | + Weight float64 `json:"weight"` |
| 25 | + Percentage float64 `json:"percentage"` |
| 26 | + Error string `json:"error"` |
36 | 27 | }
|
37 | 28 |
|
38 |
| -type Test struct { |
39 |
| - Path string |
40 |
| - Result int |
41 |
| - Time float64 |
42 |
| - Cover float64 |
43 |
| -} |
44 |
| - |
45 |
| -type File struct { |
46 |
| - Color string |
47 |
| - CycloVal string |
48 |
| - CycloInfo string |
49 |
| -} |
50 |
| - |
51 |
| -type Copycode struct { |
52 |
| - Files string |
53 |
| - Path []string |
54 |
| -} |
55 |
| - |
56 |
| -type Race struct { |
57 |
| - Pkg string |
58 |
| - Len string |
59 |
| - Leng string |
60 |
| - Info []string |
61 |
| -} |
62 |
| - |
63 |
| -type Simple struct { |
64 |
| - Path string |
65 |
| - Info string |
66 |
| -} |
67 |
| - |
68 |
| -type Scan struct { |
69 |
| - Path string |
70 |
| - Info string |
71 |
| -} |
72 |
| - |
73 |
| -type Deadcode struct { |
74 |
| - Path string |
75 |
| - Info string |
76 |
| -} |
77 |
| -type CycloInfo struct { |
78 |
| - Comp int |
79 |
| - Info string |
80 |
| -} |
81 |
| -type Cyclo struct { |
82 |
| - Pkg string |
83 |
| - Size int |
84 |
| - Info []CycloInfo |
85 |
| -} |
86 |
| - |
87 |
| -type HtmlData struct { |
88 |
| - Project string |
89 |
| - Score int |
90 |
| - Tests string |
91 |
| - TestSummaryCoverAvg string |
92 |
| - Races []Race |
93 |
| - NoTests string |
94 |
| - Simples string |
95 |
| - SimpleLevel int |
96 |
| - Deadcodes string |
97 |
| - Copycodes string |
98 |
| - Cyclos string |
99 |
| - CycloSummarysCycloAvg string |
100 |
| - CycloSummarysCyclo50 string |
101 |
| - CycloSummarysCyclo15 string |
102 |
| - DepGraph template.HTML |
103 |
| -} |
104 |
| - |
105 |
| -type ApolloMeta struct { |
106 |
| - Branch string `json:"branch"` |
107 |
| - Project string `json:"project"` |
108 |
| - CommitID string `json:"commitid"` |
109 |
| - CommitUser string `json:"commituser"` |
110 |
| - User string `json:"user"` |
111 |
| - UnintTestCover string `json:"uninttestcover"` |
112 |
| - StaticCheck string `json:"staticcheck"` |
113 |
| - CycloBig string `json:"cyclobig"` |
114 |
| - Score int `json:"score"` |
115 |
| - Starttime string `json:"starttime"` |
116 |
| - Endtime string `json:"endtime"` |
| 29 | +// Reporter is the top struct of GoReporter. |
| 30 | +type Reporter struct { |
| 31 | + Project string `json:"project"` |
| 32 | + Score int `json:"score"` |
| 33 | + Grade int `json:"grade"` |
| 34 | + Metrics map[string]Metric `json:"metrics"` |
| 35 | + Issues int `json:"issues"` |
| 36 | + TimeStamp string `json:"time_stamp"` |
117 | 37 | }
|
118 |
| - |
119 |
| -// type OptionMeta struct { |
120 |
| -// Branch string `json:"branch"` |
121 |
| -// CommitID string `json:"commitID"` |
122 |
| -// CommitUser string `json:"commitUser"` |
123 |
| -// User string `json:"user"` |
124 |
| -// } |
125 |
| - |
126 |
| -// type Value struct { |
127 |
| -// Filepath string `json:"filepath"` |
128 |
| -// Meta ApolloMeta `json:"meta"` |
129 |
| -// } |
0 commit comments