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
37
38
39
// Fixture with known complexity values, used by integration tests.
package sample
// Cognitive: for(+1) + nested for(+2) + nested if(+3) + labelled continue(+1) = 7
// Cyclomatic: base 1 + for + for + if = 4
func sumOfPrimes(max int) int
// Cognitive: switch(+1) = 1 ; Cyclomatic: base 1 + 2 non-default cases = 3
func getWords(n int) string
// Cognitive: if(+1) + &&(+1) = 2 ; Cyclomatic: base 1 + if + && = 3
func classify(a, b bool) string