Genese complexity report

<- demo.mock.ts
Methods : 8
Complexity index : 44.8
Cyclomatic complexity : 16
Cognitive complexity
87.5 % Correct 7/8
0 % Warning 0/8 (threshold : 10)
12.5 % Error 1/8 (threshold : 20)
Cyclomatic complexity
100 % Correct 8/8
0 % Warning 0/8 (threshold : 5)
0 % Error 0/8 (threshold : 10)
Methods of demo.mock.ts
ifAlone Complexity Index 1.6 Cyclomatic complexity 2
                            
                                
            
            
            
                // @ts-ignore
                ifAlone(a) { // --------------- +0.2 Complexity index (+0.2 atomic)
                    if (a) { // --------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        return 'b'; // -------- +0.2 Complexity index (+0.2 atomic)
                    }
                }
            
                            
                        
twoIfs Complexity Index 3.1 Cyclomatic complexity 3
                            
                                
                
            
            
                // @ts-ignore
                twoIfs(a, b) { // ------------ +0.3 Complexity index (+0.3 atomic)
                    if (a) { // -------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        return 'b'; // ------- +0.2 Complexity index (+0.2 atomic)
                    }
                    if (b) { // -------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        return 'c'; // ------- +0.2 Complexity index (+0.2 atomic)
                    }
                }
            
                            
                        
ifNestedIf Complexity Index 3.6 Cyclomatic complexity 3
                            
                                
                
            
            
                // @ts-ignore
                ifNestedIf(a, b) { // ------------ +0.3 Complexity index (+0.3 atomic)
                    if (a) { // ------------------ +1.2 Complexity index (+0.2 atomic, +1 structural)
                        if (b) { // -------------- +1.7 Complexity index (+0.2 atomic, +0.5 nesting, +1 structural)
                            return 'c'; // ------- +0.2 Complexity index (+0.2 atomic)
                        }
                        return 'b'; // ----------- +0.2 Complexity index (+0.2 atomic)
                    }
                }
            
                            
                        
ifIfIf Complexity Index 6.1 Cyclomatic complexity 4
                            
                                
                
            
            
                // @ts-ignore
                ifIfIf(a, b, c) { // ----------------- +0.4 Complexity index (+0.4 atomic)
                    if (a) { // ---------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        if (b) { // ------------------ +1.7 Complexity index (+0.2 atomic, +0.5 nesting, +1 structural)
                            if (c) { // -------------- +2.2 Complexity index (+0.2 atomic, +1 nesting, +1 structural)
                                return 'd'; // ------- +0.2 Complexity index (+0.2 atomic)
                            }
                            return 'c'; // ----------- +0.2 Complexity index (+0.2 atomic)
                        }
                        return 'b'; // --------------- +0.2 Complexity index (+0.2 atomic)
                    }
                }
            
                            
                        
switchCase Complexity Index 2.9 Cyclomatic complexity 1
                            
                                
                
            
            
                switchCase(a) { // ------------------- +0.2 Complexity index (+0.2 atomic)
                    switch (a) { // ------------------ +1.2 Complexity index (+0.2 atomic, +1 structural)
                        case 1: // ------------------- +0.2 Complexity index (+0.2 atomic)
                            return 'one'; // --------- +0.2 Complexity index (+0.2 atomic)
                        case 2: // ------------------- +0.2 Complexity index (+0.2 atomic)
                            return 'two'; // --------- +0.2 Complexity index (+0.2 atomic)
                        case 3: // ------------------- +0.2 Complexity index (+0.2 atomic)
                            return 'three'; // ------- +0.2 Complexity index (+0.2 atomic)
                        default: // ------------------ +0.1 Complexity index (+0.1 atomic)
                            return 'other'; // ------- +0.2 Complexity index (+0.2 atomic)
                    }
                }
            
                            
                        
recursion Complexity Index 3.5 Cyclomatic complexity 1
                            
                                
                
            
                recursion(a) { // --------------- +2.2 Complexity index (+0.2 atomic, +2 recursivity)
                    this.recursion(a); // ------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                }
            
                            
                        
methodWithCallback Complexity Index 3.5 Cyclomatic complexity 1
                            
                                
                
            
            
                methodWithCallback(a, callback) { // ------- +2.3 Complexity index (+0.3 atomic, +2 recursivity)
                    callback(a); // ------------------------ +1.2 Complexity index (+0.2 atomic, +1 structural)
                }
            
                            
                        
hyperComplex Complexity Index 20.5 Cyclomatic complexity 1
                            
                                
                
            
                hyperComplex<T>(object: Object, path: string | string[] = '', value: any): CallbacksMock<T> { // ------- +1.4 Complexity index (+1.4 atomic)
                    path = path.toString().match(/[^.[\]]+/g); // ------------------------------------------------------ +4.5 Complexity index (+0.6 atomic, +0.9 aggregation, +3 structural)
                    path.slice(0, -1).reduce((acc: Object, curr: any, index: number) => { // --------------------------- +7.2 Complexity index (+1.2 atomic, +3 structural, +3 use)
                        const arg = Math.round(index) % 3; // ---------------------------------------------------------- +1.7 Complexity index (+0.7 atomic, +1 structural)
                        return Object(acc[curr]) === acc[curr + arg][0]; // -------------------------------------------- +3.0 Complexity index (+1.0 atomic, +1 aggregation, +1 structural)
                    }, object)[path[path.length - 1]] = value; // ------------------------------------------------------ +2.2 Complexity index (+0.7 atomic, +1.5 depth)
                    return new CallbacksMock<T>(object); // ------------------------------------------------------------ +0.5 Complexity index (+0.5 atomic)
                }