File tree 2 files changed +14
-9
lines changed
2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ Install goreporter (see above).
76
76
## Run it:
77
77
78
78
```
79
- $ goreporter -p [projectRelativePath] -r [reportPath] -e [exceptPackagesName] -f [json/html] {-t templatePathIfHtml}
79
+ $ goreporter -p [projectRelativePath] -r [reportPath] -e [exceptPackagesName] -f [json/html/text ] {-t templatePathIfHtml}
80
80
```
81
81
82
82
- -p Must be a valid Golang project path.
Original file line number Diff line number Diff line change 1
1
package tools
2
2
3
3
import (
4
- "os"
5
4
"encoding/json"
5
+ "os"
6
6
7
7
"github.com/fatih/color"
8
8
"github.com/wgliang/goreporter/engine"
@@ -28,20 +28,25 @@ _/_/ _/
28
28
`
29
29
metricsHeaderTpl = `>> %s Linter %s find:`
30
30
summaryHeaderTpl = ` %s: %s`
31
- errorInfoTpl = ` %s at line %d`
31
+ errorInfoTpl = ` %s at line %d`
32
32
)
33
33
34
34
// DisplayAsText will display the json data to console
35
35
func DisplayAsText (jsonData []byte ) {
36
36
var structData engine.Reporter
37
37
json .Unmarshal (jsonData , & structData )
38
38
39
+ var score float64
40
+ for _ , metric := range structData .Metrics {
41
+ score = score + metric .Percentage * metric .Weight
42
+ }
43
+
39
44
color .Magenta (
40
- headerTpl ,
41
- structData .Project ,
42
- structData . Score ,
43
- structData .Grade ,
44
- structData .TimeStamp ,
45
+ headerTpl ,
46
+ structData .Project ,
47
+ int ( score ),
48
+ structData .Grade ,
49
+ structData .TimeStamp ,
45
50
structData .Issues ,
46
51
)
47
52
for _ , metric := range structData .Metrics {
@@ -62,4 +67,4 @@ func DisplayAsText(jsonData []byte) {
62
67
} else {
63
68
os .Exit (0 )
64
69
}
65
- }
70
+ }
You can’t perform that action at this time.
0 commit comments