Genese complexity report

<- ast-folder.model.ts
Methods : 6
Complexity index : 49
Cyclomatic complexity : 15
Cognitive complexity
83.3 % Correct 5/6
16.7 % Warning 1/6 (threshold : 10)
0 % Error 0/6 (threshold : 20)
Cyclomatic complexity
100 % Correct 6/6
0 % Warning 0/6 (threshold : 5)
0 % Error 0/6 (threshold : 10)
Methods of ast-folder.model.ts
evaluate Complexity Index 5.4 Cyclomatic complexity 1
                            
                                
                
            
            
            
                // ---------------------------------------------------------------------------------
                //                                  Other methods
                // ---------------------------------------------------------------------------------
            
            
            
                /**
                 * Evaluates and sets the complexities of the AstFiles of this AstFolder (including its subfolders)
                 */
                evaluate(): void { // ---------------------------------------------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                    this.cpxFactors = new CpxFactors(); // ------------------------------------------------------------------- +0.5 Complexity index (+0.5 atomic)
                    this.evaluateCpxFactors(this); // ------------------------------------------------------------------------ +1.3 Complexity index (+0.3 atomic, +1 structural)
                    this.numberOfMethods = this._astFolderService.getNumberOfMethods(this); // ------------------------------- +1.7 Complexity index (+0.7 atomic, +1 structural)
                    this.stats = this._astFolderService.calculateStats(this); // --------------------------------------------- +1.7 Complexity index (+0.7 atomic, +1 structural)
                }
            
                            
                        
evaluateStandalone Complexity Index 5.8 Cyclomatic complexity 1
                            
                                
                
            
            
                /**
                 * Evaluates and sets the complexities of the AstFiles of this AstFolder
                 * But not based on methods
                 */
                evaluateStandalone(): void { // --------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                    this.cpxFactors = new CpxFactors(); // ---------------------------------------- +0.5 Complexity index (+0.5 atomic)
                    const astFile = this.astFiles[0]; // ------------------------------------------ +0.5 Complexity index (+0.5 atomic)
                    astFile.evaluateStandalone(); // ---------------------------------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                    this.addCpx(astFile); // ------------------------------------------------------ +1.3 Complexity index (+0.3 atomic, +1 structural)
                    this.numberOfMethods = 0; // -------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                    this.stats = this._astFolderService.calculateStats(this); // ------------------ +1.7 Complexity index (+0.7 atomic, +1 structural)
                }
            
                            
                        
evaluateCpxFactors Complexity Index 8.2 Cyclomatic complexity 3
                            
                                
                
            
            
                /**
                 * Evaluates and sets the complexities of the AstFiles of a given AstFolder (including its subfolders)
                 * @param astFolder     // The "parent" AstFolder
                 */
                private evaluateCpxFactors(astFolder: AstFolder): void { // ----------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                    for (const astFile of astFolder.astFiles) { // -------------------------------------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                        astFile.evaluate(); // ---------------------------------------------------------------------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        this.addCpx(astFile); // -------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    }
                    for (const childAstFolder of astFolder.children) { // ------------------------------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                        childAstFolder.evaluate(); // --------------------------------------------------------------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        this.addCpx(childAstFolder); // ------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    }
                }
            
                            
                        
addCpx Complexity Index 5 Cyclomatic complexity 1
                            
                                
                
            
            
                private addCpx(element: AstFile | AstFolder): void { // ----------------------------------------------- +0.6 Complexity index (+0.6 atomic)
                    this.cpxFactors = this.cpxFactors.add(element.cpxFactors); // ------------------------------------- +1.8 Complexity index (+0.8 atomic, +1 structural)
                    this.cyclomaticCpx = this.cyclomaticCpx + element.cyclomaticCpx; // ------------------------------- +0.8 Complexity index (+0.8 atomic)
                    this.complexitiesByStatus = this.complexitiesByStatus.add(element.complexitiesByStatus); // ------- +1.8 Complexity index (+0.8 atomic, +1 structural)
                }
            
                            
                        
logg Complexity Index 15.8 Cyclomatic complexity 5
                            
                                
                
            
            
                /**
                 * Logs the main elements of the AstFolder
                 * @param message       // An optional message
                 */
                logg(message?: string): void { // ------------------------------------------ +0.4 Complexity index (+0.4 atomic)
                    console.log('-----------------------------'); // ----------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    console.log(chalk.yellowBright(message ?? 'AST_FOLDER')); // ----------- +2.7 Complexity index (+0.7 atomic, +2 structural)
                    console.log(this.path); // --------------------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                    console.log('-----------------------------'); // ----------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    console.log(chalk.blueBright('parent :'), this.parent?.path); // ------- +2.8 Complexity index (+0.8 atomic, +2 structural)
                    for (const astFile of this.astFiles) { // ------------------------------ +1.4 Complexity index (+0.4 atomic, +1 structural)
                        const name = astFile?.name ?? ''; // ------------------------------- +0.6 Complexity index (+0.6 atomic)
                        console.log(chalk.yellowBright(`  ${name}`)); // ------------------- +2.5 Complexity index (+0.5 atomic, +2 structural)
                        this.loggChildren(astFile?.astNode, `  `) // ----------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                    }
                }
            
                            
                        
loggChildren Complexity Index 8.8 Cyclomatic complexity 4
                            
                                
                
            
            
                /**
                 * Logs the main elements of the children of the AstFolder's AstNode
                 * @param astNode       // The AstNode of the AstFolder
                 * @param indent        // The indentation of the current AstNode (in the log)
                 */
                private loggChildren(astNode: AstNode, indent = ''): void { // -------------------------- +2.6 Complexity index (+0.6 atomic, +2 recursivity)
                    for (const childAstNode of astNode?.children) { // ---------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                        const name = childAstNode?.name ?? ''; // --------------------------------------- +0.6 Complexity index (+0.6 atomic)
                        console.log(chalk.blueBright(`${indent}${childAstNode.kind}`), name); // -------- +2.8 Complexity index (+0.8 atomic, +2 structural)
                        this.loggChildren(childAstNode, `${indent}  `) // ------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                    }
                }