Skip to content

Commit

Permalink
Add details field to --format=json
Browse files Browse the repository at this point in the history
  • Loading branch information
inferno-chromium committed Nov 24, 2020
1 parent 6a7eb62 commit 09518b4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type checkResult struct {
CheckName string
Pass bool
Confidence int
Details []string
}

type record struct {
Expand All @@ -127,11 +128,17 @@ func outputJSON(results []pkg.Result) {
Repo: repo.String(),
Date: d.Format("2006-01-02"),
}

for _, r := range results {
var details []string
if showDetails {
details = r.Cr.Details
}
or.Checks = append(or.Checks, checkResult{
CheckName: r.Name,
Pass: r.Cr.Pass,
Confidence: r.Cr.Confidence,
Details: details,
})
}
output, err := json.Marshal(or)
Expand Down

0 comments on commit 09518b4

Please sign in to comment.