Skip to content

Commit

Permalink
add properties to result object
Browse files Browse the repository at this point in the history
  • Loading branch information
owenrumney committed Jun 7, 2021
1 parent ede05a7 commit 652a4a1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions sarif/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ type Result struct {
WorkItemUris []string `json:"workItemUris,omitempty"` // can be null
HostedViewerUri *string `json:"hostedViewerUri,omitempty"`
// Provenance *resultProvenance `json:"provenance,omitempty"`
Fixes []*Fix `json:"fixes,omitempty"`
OccurrenceCount *uint `json:"occurrenceCount,omitempty"`
Fixes []*Fix `json:"fixes,omitempty"`
OccurrenceCount *uint `json:"occurrenceCount,omitempty"`
Properties Properties `json:"properties,omitempty"`
}

func newRuleResult(ruleID string) *Result {
Expand Down Expand Up @@ -141,3 +142,14 @@ func (r *Result) WithOccurrenceCount(occurrenceCount int) *Result {
r.OccurrenceCount = &count
return r
}

// WithProperties specifies properties for a rule and returns the updated rule
func (r *Result) WithProperties(properties Properties) *Result {
r.Properties = properties
return r
}

// AttachPropertyBag adds a property bag to a rule
func (r *Result) AttachPropertyBag(pb *PropertyBag) {
r.Properties = pb.Properties
}

0 comments on commit 652a4a1

Please sign in to comment.