-
Notifications
You must be signed in to change notification settings - Fork 17
/
c.go
36 lines (27 loc) · 783 Bytes
/
c.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package testdata
type Node[T any] struct {
}
func (n *Node[T]) String() string { // want "cognitive complexity 1 of func \\(\\*Node\\[T\\]\\)\\.String is high \\(> 0\\)"
if n != nil { // +1
return "Node"
}
return ""
} // total complexity = 1
type Pair[K any, V any] struct {
Key K
Value V
}
func (p *Pair[K, V]) String() string { // want "cognitive complexity 1 of func \\(\\*Pair\\[K, V\\]\\)\\.String is high \\(> 0\\)"
if p != nil { // +1
return "Pair"
}
return ""
} // total complexity = 1
type Triple[K any, V any, T any] struct {
}
func (t *Triple[K, V, T]) String() string { // want "cognitive complexity 1 of func \\(\\*Triple\\[K, V, T\\]\\)\\.String is high \\(> 0\\)"
if t != nil { // +1 `
return "Triple"
}
return ""
} // total complexity = 1