Genese complexity report

<- unary-expression.ts
Methods : 2
Complexity index : 29.9
Cyclomatic complexity : 5
Cognitive complexity
0 % Correct 0/2
100 % Warning 2/2 (threshold : 10)
0 % Error 0/2 (threshold : 20)
Cyclomatic complexity
100 % Correct 2/2
0 % Warning 0/2 (threshold : 5)
0 % Error 0/2 (threshold : 10)
Methods of unary-expression.ts
run Complexity Index 18.8 Cyclomatic complexity 2
                            
                                
            
            
            // @ts-ignore
            export function run(cstNode: UnaryExpression, children: UnaryExpressionChildren): any { // ------------------------ +0.6 Complexity index (+0.6 atomic)
                const unaryPrefixOperator = children.UnaryPrefixOperator; // -------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                const primary = children.primary // --------------------------------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
            
                if (unaryPrefixOperator) { // --------------------------------------------------------------------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                    const unaryPrefixOperatorAst = unaryPrefixOperator.map(e => cstToAst(e, 'unaryPrefixOperator')); // ------- +4.4 Complexity index (+0.9 atomic, +0.5 nesting, +3 structural)
                    return toUnaryPrefixOperator(unaryPrefixOperatorAst, primary.map(e => cstToAst(e))); // ------------------- +5.4 Complexity index (+0.9 atomic, +0.5 nesting, +4 structural)
                } else { // --------------------------------------------------------------------------------------------------- +1.1 Complexity index (+0.1 atomic, +1 structural)
                    return [ // ----------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                        // ...unaryPrefixOperator?.map(e => cstToAst(e, 'unaryPrefixOperator')) ?? [],
                        ...[].concat(...primary.map(e => cstToAst(e))) // ----------------------------------------------------- +5.2 Complexity index (+0.7 atomic, +0.5 nesting, +4 structural)
                    ];
                }
            }
            
                            
                        
toUnaryPrefixOperator Complexity Index 11.1 Cyclomatic complexity 3
                            
                                
            
            
            
            function toUnaryPrefixOperator(prefixes: any[], primaries: any[]): any { // ------- +0.8 Complexity index (+0.8 atomic)
                let res = undefined; // ------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                let last = undefined; // ------------------------------------------------------ +0.3 Complexity index (+0.3 atomic)
                while (prefixes.length > 0) { // ---------------------------------------------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                    const firstPrefix = prefixes.shift(); // ---------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                    if (!res) { // ------------------------------------------------------------ +1.7 Complexity index (+0.2 atomic, +0.5 nesting, +1 structural)
                        last = firstPrefix; // ------------------------------------------------ +0.3 Complexity index (+0.3 atomic)
                        res = last; // -------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                    } else { // --------------------------------------------------------------- +1.1 Complexity index (+0.1 atomic, +1 structural)
                        last.children.push(firstPrefix); // ----------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                        last = firstPrefix; // ------------------------------------------------ +0.3 Complexity index (+0.3 atomic)
                    }
                }
                last.children = [...[].concat(...primaries)]; // ------------------------------ +1.5 Complexity index (+0.5 atomic, +1 structural)
                return res; // ---------------------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
            }