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

hkid.CheckPart   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
nop 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