Passed
Push — master ( f028f1...4fb92b )
by Stefano
02:12
created

filter.NewHTTPStatusResultFilter   A

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
package filter
2
3
import (
4
	"github.com/stefanoj3/dirstalk/pkg/scan"
5
)
6
7
func NewHTTPStatusResultFilter(httpStatusesToIgnore []int) HTTPStatusResultFilter {
0 ignored issues
show
introduced by
exported function NewHTTPStatusResultFilter should have comment or be unexported
Loading history...
8
	httpStatusesToIgnoreMap := make(map[int]struct{}, len(httpStatusesToIgnore))
9
	for _, statusToIgnore := range httpStatusesToIgnore {
10
		httpStatusesToIgnoreMap[statusToIgnore] = struct{}{}
11
	}
12
13
	return HTTPStatusResultFilter{httpStatusesToIgnoreMap: httpStatusesToIgnoreMap}
14
}
15
16
type HTTPStatusResultFilter struct {
0 ignored issues
show
introduced by
exported type HTTPStatusResultFilter should have comment or be unexported
Loading history...
17
	httpStatusesToIgnoreMap map[int]struct{}
18
}
19
20
func (f HTTPStatusResultFilter) ShouldIgnore(result scan.Result) bool {
0 ignored issues
show
introduced by
exported method HTTPStatusResultFilter.ShouldIgnore should have comment or be unexported
Loading history...
21
	_, found := f.httpStatusesToIgnoreMap[result.StatusCode]
22
	return found
23
}
24