Skip to content

Commit 4d4b7f4

Browse files
committed
feat: refactor cvss property name
1 parent 8503ad3 commit 4d4b7f4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

report/report.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ type CVEMeta struct {
3131
CVSSMeta *CVSS `yaml:",omitempty"`
3232
}
3333
type CVSS struct {
34-
Version string `yaml:",omitempty"`
35-
BaseScore float32 `yaml:",omitempty"`
36-
Vector string `yaml:",omitempty"`
34+
Version string `yaml:",omitempty"`
35+
Score float32 `yaml:",omitempty"`
36+
Vector string `yaml:",omitempty"`
3737
}
3838

3939
type Report struct {

report/utils.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ func CvssScoreToSeverity(cvss *CVSS) string {
88
}
99
switch cvss.Version {
1010
case "v2":
11-
return cvssV2SeverityByScore(cvss.BaseScore)
11+
return cvssV2SeverityByScore(cvss.Score)
1212
case "v3":
13-
return cvssV3SeverityByScore(cvss.BaseScore)
13+
return cvssV3SeverityByScore(cvss.Score)
1414
default:
1515
return ""
1616
}

report/utils_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestReverseString1(t *testing.T) {
2323
}
2424
for _, tt := range tests {
2525
t.Run(tt.name, func(t *testing.T) {
26-
if got := CvssScoreToSeverity(&CVSS{Version: tt.version, BaseScore: tt.baseScore}); got != tt.want {
26+
if got := CvssScoreToSeverity(&CVSS{Version: tt.version, Score: tt.baseScore}); got != tt.want {
2727
t.Errorf("CvssScoreToSeverity() = %v, want %v", got, tt.want)
2828
}
2929
})

0 commit comments

Comments
 (0)