Genese complexity report

<- ast-folder-console-report.service.ts
Methods : 7
Complexity index : 31.7
Cyclomatic complexity : 9
Cognitive complexity
100 % Correct 7/7
0 % Warning 0/7 (threshold : 10)
0 % Error 0/7 (threshold : 20)
Cyclomatic complexity
100 % Correct 7/7
0 % Warning 0/7 (threshold : 5)
0 % Error 0/7 (threshold : 10)
Methods of ast-folder-console-report.service.ts
Complexity Index 1.2 Cyclomatic complexity 0
                            
                                
                
            
            
                constructor(astFolder: AstFolder) { // ------------------------------------------------------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                    this.astFolder = astFolder; // ----------------------------------------------------------------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                    this.astFolderService.astFolder = this.astFolder; // ------------------------------------------------------------------------------- +0.6 Complexity index (+0.6 atomic)
                }
            
                            
                        
generateReport Complexity Index 2 Cyclomatic complexity 1
                            
                                
                
            
                /**
                 * Generates the folder's report
                 */
                generateReport(): RowFileReport[] { // ------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                    this.setMethodsArraySortedByDecreasingCognitiveCpx(this.astFolder); // ------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                    return this.methodsArrayReport; // ------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                    // this.writeReport();
                }
            
                            
                        
setMethodsArraySortedByDecreasingCognitiveCpx Complexity Index 9.2 Cyclomatic complexity 1
                            
                                
                
            
                /**
                 * Set the array of methods sorted by decreasing cognitive complexity
                 * @param astFolder    // The AstFolder to analyse
                 */
                private setMethodsArraySortedByDecreasingCognitiveCpx(astFolder: AstFolder): void { // ---------------------------------------------- +0.4 Complexity index (+0.4 atomic)
                    this.setTsFileReport(astFolder); // --------------------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    this.setMethodsArrayReport(astFolder); // --------------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    this.methodsArrayReport = AstMethodService.sortByDecreasingCognitiveCpx(this.methodsArrayReport); // ---------------------------- +1.7 Complexity index (+0.7 atomic, +1 structural)
                    this.methodsArrayReport = this.methodsArrayReport.filter(e => e.cpxIndex >= Options.getThresholds().cognitive.warning) // ------- +4.5 Complexity index (+1.5 atomic, +3 structural)
                }
            
                            
                        
setMethodsArrayReport Complexity Index 6.4 Cyclomatic complexity 2
                            
                                
                
            
                /**
                 * Recursion setting the array of methods reports of each subFolder
                 * @param astFolder    // The AstFolder to analyse
                 */
                private setMethodsArrayReport(astFolder: AstFolder): void { // --------------- +2.4 Complexity index (+0.4 atomic, +2 recursivity)
                    for (const subFolder of astFolder.children) { // ------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                        this.setTsFileReport(subFolder); // ---------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                        this.setMethodsArrayReport(subFolder); // ---------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    }
                }
            
                            
                        
setTsFileReport Complexity Index 3.1 Cyclomatic complexity 2
                            
                                
                
            
                /**
                 * Recursion setting the array of methods reports of each subFolder's files
                 * @param astFolder    // The AstFolder to analyse
                 */
                private setTsFileReport(astFolder: AstFolder): void{ // ------------------------------ +0.4 Complexity index (+0.4 atomic)
                    for (const tsFile of astFolder.astFiles){ // ------------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                        this.setAstMethodReport(tsFile) // ------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    }
                }
            
                            
                        
setAstMethodReport Complexity Index 8 Cyclomatic complexity 2
                            
                                
                
            
                /**
                 * Recursion setting the array of methods reports of each file's methods
                 * @param astFile    // The AstFile to analyse
                 */
                private setAstMethodReport(astFile: AstFile): void{ // ----------------------------- +0.4 Complexity index (+0.4 atomic)
                    for (const astMethod of astFile.astMethods) { // ------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                        this.methodsArrayReport.push({ // ------------------------------------------ +1.3 Complexity index (+0.3 atomic, +1 structural)
                            cognitiveColor: astMethod.cognitiveStatus.toLowerCase(), // ------------ +1.4 Complexity index (+0.4 atomic, +1 structural)
                            cpxIndex: astMethod.cpxIndex, // --------------------------------------- +0.3 Complexity index (+0.3 atomic)
                            cyclomaticColor: astMethod.cyclomaticStatus.toLowerCase(), // ---------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                            cyclomaticValue: astMethod.cyclomaticCpx, // --------------------------- +0.3 Complexity index (+0.3 atomic)
                            filename: `file://${astFile.astFolder.path}/${astFile.name}`, // ------- +0.6 Complexity index (+0.6 atomic)
                            linkFile: `${astFile.astFolder.path}/${astFile.name}`, // -------------- +0.6 Complexity index (+0.6 atomic)
                            methodName: astMethod.name, // ----------------------------------------- +0.3 Complexity index (+0.3 atomic)
                        })
                    }
                }
            
                            
                        
writeReport Complexity Index 1.8 Cyclomatic complexity 1
                            
                                
                
            
                /**
                 * Fills the HandleBar's template
                 */
                private writeReport() { // --------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                    console.table(this.methodsArrayReport, ['file', 'methodName', 'cpxIndex']); // ------- +1.7 Complexity index (+0.7 atomic, +1 structural)
                }