Genese complexity report

<- ternaryToCoalescing.refactorer.ts
Methods : 2
Complexity index : 47.2
Cyclomatic complexity : 9
Cognitive complexity
0 % Correct 0/2
0 % Warning 0/2 (threshold : 10)
100 % Error 2/2 (threshold : 20)
Cyclomatic complexity
100 % Correct 2/2
0 % Warning 0/2 (threshold : 5)
0 % Error 0/2 (threshold : 10)
Methods of ternaryToCoalescing.refactorer.ts
refactorNeeded Complexity Index 23.3 Cyclomatic complexity 5
                            
                                
                
            
                refactorNeeded(node: Node): boolean { // --------------------------------------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                    let refactorNeeded = false; // --------------------------------------------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                    const TERNARY_EXPRESSIONS = node.getDescendantsOfKind(SyntaxKind.ConditionalExpression); // -------------------------------------- +1.6 Complexity index (+0.6 atomic, +1 structural)
                    TERNARY_EXPRESSIONS.forEach((ternary: ConditionalExpression) => { // ------------------------------------------------------------- +2.5 Complexity index (+0.5 atomic, +2 structural)
                        const COUNT = ternary.getChildCount(); // ------------------------------------------------------------------------------------ +1.4 Complexity index (+0.4 atomic, +1 structural)
                        if (Node.isConditionalExpression(ternary) && COUNT > 0) { // ----------------------------------------------------------------- +4.9 Complexity index (+0.9 atomic, +1 nesting, +3 structural)
                            const FIRST_MEMBER = ternary.getChildAtIndex(0); // ---------------------------------------------------------------------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                            const SECOND_MEMBER = ternary.getChildAtIndex(2); // --------------------------------------------------------------------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                            if (FIRST_MEMBER.getText() === SECOND_MEMBER.getText() && FIRST_MEMBER.getKind() === SECOND_MEMBER.getKind()) { // ------- +8.8 Complexity index (+1.3 atomic, +1.5 nesting, +6 structural)
                                refactorNeeded = true; // -------------------------------------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                            }
                        }
                    });
                    return refactorNeeded; // -------------------------------------------------------------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                }
            
                            
                        
refactor Complexity Index 23.9 Cyclomatic complexity 4
                            
                                
                
            
                /**
                 * Copy current method then transform the copy to get refctored method
                 * Put refactored method on current method object
                 * @param method the current method
                 * @returns {void}
                 */
                refactor(node: Node): Node { // ------------------------------------------------------------------------------------------------------ +0.4 Complexity index (+0.4 atomic)
                    return node.transform((traversal: TransformTraversalControl) => { // ------------------------------------------------------------- +2.6 Complexity index (+0.6 atomic, +2 structural)
                        const currentNode = Refactorer.wrapCurrentNode(node, traversal); // ---------------------------------------------------------- +1.6 Complexity index (+0.6 atomic, +1 structural)
                        if (Node.isConditionalExpression(currentNode)) { // -------------------------------------------------------------------------- +3.4 Complexity index (+0.4 atomic, +1 nesting, +2 structural)
                            const FIRST_MEMBER = currentNode.getChildAtIndex(0); // ------------------------------------------------------------------ +1.5 Complexity index (+0.5 atomic, +1 structural)
                            const SECOND_MEMBER = currentNode.getChildAtIndex(2); // ----------------------------------------------------------------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                            if (FIRST_MEMBER.getText() === SECOND_MEMBER.getText() && FIRST_MEMBER.getKind() === SECOND_MEMBER.getKind()) { // ------- +8.8 Complexity index (+1.3 atomic, +1.5 nesting, +6 structural)
                                const THIRD_MEMBER = currentNode.getChildAtIndex(4); // -------------------------------------------------------------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                                return ts.createBinary( // ------------------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                                    FIRST_MEMBER.compilerNode as ts.Identifier, // ------------------------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                                    SyntaxKind.QuestionQuestionToken, // ----------------------------------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                                    THIRD_MEMBER.compilerNode as ts.Identifier // -------------------------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                                );
                            }
                        }
                        return currentNode.compilerNode; // ------------------------------------------------------------------------------------------ +0.3 Complexity index (+0.3 atomic)
                    });
                }