Skip to content

Commit

Permalink
Merge pull request #14 from goark/debug-and-refactoring
Browse files Browse the repository at this point in the history
Fix validation of CVSSv3 vector string (issue #13)
  • Loading branch information
spiegel-im-spiegel committed Jan 25, 2023
2 parents 742c132 + 2a0df4d commit 389ba06
Show file tree
Hide file tree
Showing 98 changed files with 451 additions and 4,056 deletions.
8 changes: 6 additions & 2 deletions cvsserr/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cvsserr

import "fmt"

//Num is error number for CVSS
// Num is error number for CVSS
type Num int

const (
Expand All @@ -12,6 +12,8 @@ const (
ErrNotSupportVer
ErrNotSupportMetric
ErrInvalidTemplate
ErrSameMetric
ErrInvalidValue
)

var errMessage = map[Num]string{
Expand All @@ -21,6 +23,8 @@ var errMessage = map[Num]string{
ErrNotSupportVer: "not support version",
ErrNotSupportMetric: "not support metric",
ErrInvalidTemplate: "invalid templete string",
ErrSameMetric: "exist same metric",
ErrInvalidValue: "invalid value of metric",
}

func (n Num) Error() string {
Expand All @@ -30,7 +34,7 @@ func (n Num) Error() string {
return fmt.Sprintf("unknown error (%d)", int(n))
}

/* Copyright 2018-2020 Spiegel
/* Copyright 2018-2023 Spiegel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
6 changes: 4 additions & 2 deletions cvsserr/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ func TestNumError(t *testing.T) {
{err: ErrNotSupportVer, str: "not support version"},
{err: ErrNotSupportMetric, str: "not support metric"},
{err: ErrInvalidTemplate, str: "invalid templete string"},
{err: Num(7), str: "unknown error (7)"},
{err: ErrSameMetric, str: "exist same metric"},
{err: ErrInvalidValue, str: "invalid value of metric"},
{err: Num(9), str: "unknown error (9)"},
}

for _, tc := range testCases {
Expand All @@ -28,7 +30,7 @@ func TestNumError(t *testing.T) {
}
}

/* Copyright 2019,2020 Spiegel
/* Copyright 2019-2023 Spiegel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
338 changes: 0 additions & 338 deletions v3/base/base.go

This file was deleted.

Loading

0 comments on commit 389ba06

Please sign in to comment.