File tree 3 files changed +23
-0
lines changed
3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ func Initialize() {
27
27
// superprojectType = projecttype.All
28
28
29
29
outputFormat = "text"
30
+ //reportFilePath = paths.New("report.json")
30
31
31
32
feedback .SetFormat (feedback .JSON )
32
33
logrus .SetLevel (logrus .PanicLevel )
@@ -66,6 +67,13 @@ func OutputFormat() string {
66
67
return outputFormat
67
68
}
68
69
70
+ var reportFilePath * paths.Path
71
+
72
+ // ReportFilePath returns the path to save the report file at.
73
+ func ReportFilePath () * paths.Path {
74
+ return reportFilePath
75
+ }
76
+
69
77
var targetPath * paths.Path
70
78
71
79
// TargetPath returns the projects search path.
Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ func main() {
40
40
fmt .Println (result .JSONReport ())
41
41
}
42
42
43
+ if configuration .ReportFilePath () != nil {
44
+ // Write report file.
45
+ result .WriteReport ()
46
+ }
47
+
43
48
if ! result .Passed () {
44
49
os .Exit (errorcodes .ErrGeneric )
45
50
}
Original file line number Diff line number Diff line change @@ -207,6 +207,16 @@ func jsonReportRaw() []byte {
207
207
return reportJSON
208
208
}
209
209
210
+ // WriteReport writes a report for all projects to the specified file.
211
+ func WriteReport () {
212
+ // Write report file
213
+ err := configuration .ReportFilePath ().WriteFile (jsonReportRaw ())
214
+ if err != nil {
215
+ feedback .Errorf ("Error while writing report: %v" , err )
216
+ os .Exit (errorcodes .ErrGeneric )
217
+ }
218
+ }
219
+
210
220
// Passed returns whether the checks passed cumulatively.
211
221
func Passed () bool {
212
222
return report .Summary .Pass
You can’t perform that action at this time.
0 commit comments