From 4d4b7f4e88d7571d73676b0724b003e6e2f8b3d8 Mon Sep 17 00:00:00 2001 From: Chen Keinan Date: Wed, 23 Jun 2021 13:07:39 +0300 Subject: [PATCH] feat: refactor cvss property name --- report/report.go | 6 +++--- report/utils.go | 4 ++-- report/utils_test.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/report/report.go b/report/report.go index 8875db8e..6fed5404 100644 --- a/report/report.go +++ b/report/report.go @@ -31,9 +31,9 @@ type CVEMeta struct { CVSSMeta *CVSS `yaml:",omitempty"` } type CVSS struct { - Version string `yaml:",omitempty"` - BaseScore float32 `yaml:",omitempty"` - Vector string `yaml:",omitempty"` + Version string `yaml:",omitempty"` + Score float32 `yaml:",omitempty"` + Vector string `yaml:",omitempty"` } type Report struct { diff --git a/report/utils.go b/report/utils.go index 4339e91e..3dde9f53 100644 --- a/report/utils.go +++ b/report/utils.go @@ -8,9 +8,9 @@ func CvssScoreToSeverity(cvss *CVSS) string { } switch cvss.Version { case "v2": - return cvssV2SeverityByScore(cvss.BaseScore) + return cvssV2SeverityByScore(cvss.Score) case "v3": - return cvssV3SeverityByScore(cvss.BaseScore) + return cvssV3SeverityByScore(cvss.Score) default: return "" } diff --git a/report/utils_test.go b/report/utils_test.go index b66d8fe0..efb4e1cc 100644 --- a/report/utils_test.go +++ b/report/utils_test.go @@ -23,7 +23,7 @@ func TestReverseString1(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if got := CvssScoreToSeverity(&CVSS{Version: tt.version, BaseScore: tt.baseScore}); got != tt.want { + if got := CvssScoreToSeverity(&CVSS{Version: tt.version, Score: tt.baseScore}); got != tt.want { t.Errorf("CvssScoreToSeverity() = %v, want %v", got, tt.want) } })