Genese complexity report

<- ternaries.mock.ts
Methods : 5
Complexity index : 21.4
Cyclomatic complexity : 8
Cognitive complexity
100 % Correct 5/5
0 % Warning 0/5 (threshold : 10)
0 % Error 0/5 (threshold : 20)
Cyclomatic complexity
100 % Correct 5/5
0 % Warning 0/5 (threshold : 5)
0 % Error 0/5 (threshold : 10)
Methods of ternaries.mock.ts
ternary Complexity Index 1.7 Cyclomatic complexity 1
                            
                                
            
            
            
                ternary(a) { // ------------------- +0.2 Complexity index (+0.2 atomic)
                    return a ? 5 : 3; // ---------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                }
            
                            
                        
nestedTernaries Complexity Index 5.1 Cyclomatic complexity 1
                            
                                
                
            
            
                nestedTernaries(a, b) { // ------------- +0.3 Complexity index (+0.3 atomic)
                    return a ? 1 : b ? 0 : 2; // ------- +4.8 Complexity index (+0.8 atomic, +2 nesting, +2 structural)
                }
            
                            
                        
ifWithTernary Complexity Index 4.8 Cyclomatic complexity 2
                            
                                
                
            
            
                ifWithTernary(a, b) { // ----------- +0.3 Complexity index (+0.3 atomic)
                    if (a) { // -------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        return 1; // --------------- +0.2 Complexity index (+0.2 atomic)
                    } else { // -------------------- +1.1 Complexity index (+0.1 atomic, +1 structural)
                        return b ? 0 : 2; // ------- +2.0 Complexity index (+0.5 atomic, +0.5 nesting, +1 structural)
                    }
                }
            
                            
                        
NoTernary Complexity Index 4.4 Cyclomatic complexity 3
                            
                                
                
            
            
                NoTernary(a, b) { // --------- +0.3 Complexity index (+0.3 atomic)
                    if (a) { // -------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        return 1; // --------- +0.2 Complexity index (+0.2 atomic)
                    } else if (b) { // ------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        return 0; // --------- +0.2 Complexity index (+0.2 atomic)
                    } else { // -------------- +1.1 Complexity index (+0.1 atomic, +1 structural)
                        return 2; // --------- +0.2 Complexity index (+0.2 atomic)
                    }
                }
            
                            
                        
ternaries Complexity Index 5.4 Cyclomatic complexity 1
                            
                                
                
            
            
                ternaries(a) { // ----------------------------------- +0.2 Complexity index (+0.2 atomic)
                    return  a > 10 ? 5 : ((a <5) ? 3 : 2); // ------- +5.2 Complexity index (+1.2 atomic, +2 nesting, +2 structural)
                }