Passed
Branch master (48d6a0)
by iLex
02:14
created

hkid.go   A

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
cc 4
eloc 11
dl 0
loc 19
ccs 8
cts 8
cp 1
crap 4
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A hkid.CheckPart 0 3 1
A hkid.CheckString 0 12 3
1
package hkid
2
3
func CheckString(string string) *result {
4 1
	hkid, e := validatePatten(string)
5
	//if errors.Is(e, newPatterNotMatchError()) {
6 1
	if e != nil {
7 1
		return newHkidResultWithValid(newHkidNil(), false)
8
	}
9
10 1
	if getRemainder(hkid) == hkid.part3 {
11 1
		return newHkidResultWithValid(hkid, true)
12
	}
13
14 1
	return newHkidResultWithValid(hkid, false)
15
}
16
17
func CheckPart(part1 string, part2 string, part3 string) *result {
18 1
	hkid := newHkid(part1, part2, part3)
19 1
	return CheckString(hkid.Format())
20
}
21