-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
fix.go
48 lines (41 loc) · 1.18 KB
/
fix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package sarif
// Fix ...
type Fix struct {
Description *Message `json:"description,omitempty"`
ArtifactChanges []*ArtifactChange `json:"artifactChanges"`
PropertyBag
}
// NewFix creates a new Fix and returns a pointer to it
func NewFix() *Fix {
return &Fix{}
}
// WithDescription sets the Description
func (fix *Fix) WithDescription(message *Message) *Fix {
fix.Description = message
return fix
}
// WithDescriptionText sets the DescriptionText
func (fix *Fix) WithDescriptionText(text string) *Fix {
if fix.Description == nil {
fix.Description = &Message{}
}
fix.Description.Text = &text
return fix
}
// WithDescriptionMarkdown sets the DescriptionMarkdown
func (fix *Fix) WithDescriptionMarkdown(markdown string) *Fix {
if fix.Description == nil {
fix.Description = &Message{}
}
fix.Description.Markdown = &markdown
return fix
}
// WithArtifactChanges sets the ArtifactChanges
func (fix *Fix) WithArtifactChanges(artifactChanges []*ArtifactChange) *Fix {
fix.ArtifactChanges = artifactChanges
return fix
}
// AddArtifactChanges ...
func (fix *Fix) AddArtifactChanges(artifactChange *ArtifactChange) {
fix.ArtifactChanges = append(fix.ArtifactChanges, artifactChange)
}