Genese complexity report

<- array-creation-expression.ts
Methods : 2
Complexity index : 42.6
Cyclomatic complexity : 16
Cognitive complexity
0 % Correct 0/2
50 % Warning 1/2 (threshold : 10)
50 % Error 1/2 (threshold : 20)
Cyclomatic complexity
0 % Correct 0/2
100 % Warning 2/2 (threshold : 5)
0 % Error 0/2 (threshold : 10)
Methods of array-creation-expression.ts
run Complexity Index 26.6 Cyclomatic complexity 7
                            
                                
            
            
            // @ts-ignore
            export function run(cstNode: ArrayCreationExpression, children: ArrayCreationExpressionChildren): any { // ------------------------ +0.6 Complexity index (+0.6 atomic)
                const arrayCreationExplicitInitSuffix = children.arrayCreationExplicitInitSuffix; // ------------------------------------------ +0.4 Complexity index (+0.4 atomic)
                const primitiveType = children.primitiveType; // ------------------------------------------------------------------------------ +0.4 Complexity index (+0.4 atomic)
                const classOrInterfaceType = children.classOrInterfaceType; // ---------------------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                const arrayCreationDefaultInitSuffix = children.arrayCreationDefaultInitSuffix; // -------------------------------------------- +0.4 Complexity index (+0.4 atomic)
            
                const classOrInterfaceTypeAst = [].concat(...classOrInterfaceType?.map(e => cstToAst(e)) ?? []); // --------------------------- +5.0 Complexity index (+1.0 atomic, +4 structural)
                const arrayCreationDefaultInitSuffixAst = [].concat(...arrayCreationDefaultInitSuffix?.map(e => cstToAst(e)) ?? []); // ------- +5.0 Complexity index (+1.0 atomic, +4 structural)
                const primitiveTypeAst = [].concat(...primitiveType?.map(e => cstToAst(e)) ?? []); // ----------------------------------------- +5.0 Complexity index (+1.0 atomic, +4 structural)
            
                const dimExprs = arrayCreationDefaultInitSuffixAst?.find(e => e.kind === 'DimExprs')?.children; // ---------------------------- +3.1 Complexity index (+1.1 atomic, +2 structural)
            
                return [ // ------------------------------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                    ...[].concat(...arrayCreationExplicitInitSuffix?.map(e => cstToAst(e)) ?? []), // ----------------------------------------- +4.8 Complexity index (+0.8 atomic, +4 structural)
                    createElementAccess([...classOrInterfaceTypeAst, ...primitiveTypeAst] , dimExprs) // -------------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                ];  
            }
            
                            
                        
createElementAccess Complexity Index 16 Cyclomatic complexity 9
                            
                                
            
            
            /**
             * Create Element Access Expression Ast Node
             * @param  {any} classOrInterfaceTypeAst
             * @param  {any} dimExprs
             * @returns any
             */
            function createElementAccess(classOrInterfaceTypeAst: any, dimExprs: any): any {   // ------- +2.6 Complexity index (+0.6 atomic, +2 recursivity)
                if (!dimExprs) return undefined; // ----------------------------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
            
                if (dimExprs.length === 1) { // --------------------------------------------------------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                    return { // ------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                        kind: 'ElementAccessExpression', // --------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                        start: classOrInterfaceTypeAst[0]?.start, // ------------------------------------ +0.4 Complexity index (+0.4 atomic)
                        end: dimExprs[0]?.end, // ------------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                        pos: classOrInterfaceTypeAst[0]?.pos, // ---------------------------------------- +0.4 Complexity index (+0.4 atomic)
                        children: [ // ------------------------------------------------------------------ +0.1 Complexity index (+0.1 atomic)
                            classOrInterfaceTypeAst.find(e => e.kind === 'Identifier'), // -------------- +3.3 Complexity index (+0.8 atomic, +0.5 nesting, +2 structural)
                            dimExprs[0]  // ------------------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                        ]
                    }
                } else { // ----------------------------------------------------------------------------- +1.1 Complexity index (+0.1 atomic, +1 structural)
                    const dimExpr = dimExprs.pop(); // -------------------------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                    return { // ------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                        kind: 'ElementAccessExpression', // --------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                        start: classOrInterfaceTypeAst[0]?.start, // ------------------------------------ +0.4 Complexity index (+0.4 atomic)
                        pos: classOrInterfaceTypeAst[0]?.pos, // ---------------------------------------- +0.4 Complexity index (+0.4 atomic)
                        end: dimExpr?.end, // ----------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                        children: [{ // ----------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                            ...createElementAccess(classOrInterfaceTypeAst, dimExprs), // --------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                            },dimExpr // ---------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                        ]
                    };      
                }
            }