forked from jfrog/frogbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissuescollection.go
56 lines (47 loc) · 1.39 KB
/
issuescollection.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
49
50
51
52
53
54
55
56
package utils
import "github.com/jfrog/jfrog-cli-core/v2/xray/formats"
type IssuesCollection struct {
Vulnerabilities []formats.VulnerabilityOrViolationRow
Iacs []formats.SourceCodeRow
Secrets []formats.SourceCodeRow
Sast []formats.SourceCodeRow
Licenses []formats.LicenseRow
}
func (ic *IssuesCollection) VulnerabilitiesExists() bool {
return len(ic.Vulnerabilities) > 0
}
func (ic *IssuesCollection) IacExists() bool {
return len(ic.Iacs) > 0
}
func (ic *IssuesCollection) LicensesExists() bool {
return len(ic.Licenses) > 0
}
func (ic *IssuesCollection) SecretsExists() bool {
return len(ic.Secrets) > 0
}
func (ic *IssuesCollection) SastExists() bool {
return len(ic.Sast) > 0
}
func (ic *IssuesCollection) IssuesExists() bool {
return ic.VulnerabilitiesExists() || ic.IacExists() || ic.LicensesExists() || ic.SastExists()
}
func (ic *IssuesCollection) Append(issues *IssuesCollection) {
if issues == nil {
return
}
if len(issues.Vulnerabilities) > 0 {
ic.Vulnerabilities = append(ic.Vulnerabilities, issues.Vulnerabilities...)
}
if len(issues.Secrets) > 0 {
ic.Secrets = append(ic.Secrets, issues.Secrets...)
}
if len(issues.Sast) > 0 {
ic.Sast = append(ic.Sast, issues.Sast...)
}
if len(issues.Iacs) > 0 {
ic.Iacs = append(ic.Iacs, issues.Iacs...)
}
if len(issues.Licenses) > 0 {
ic.Licenses = append(ic.Licenses, issues.Licenses...)
}
}