Genese complexity report

<- stats.service.ts
Methods : 4
Complexity index : 16.5
Cyclomatic complexity : 5
Cognitive complexity
75 % Correct 3/4
25 % Warning 1/4 (threshold : 10)
0 % Error 0/4 (threshold : 20)
Cyclomatic complexity
100 % Correct 4/4
0 % Warning 0/4 (threshold : 5)
0 % Error 0/4 (threshold : 10)
Methods of stats.service.ts
calculateStats Complexity Index 0.6 Cyclomatic complexity 1
                            
                                
                
                protected abstract calculateStats(fileOrFolder: AstFile | AstFolder): void; // ----------------------------------------------------------------- +0.6 Complexity index (+0.6 atomic)
            
                            
                        
getNameOrPath Complexity Index 0.6 Cyclomatic complexity 1
                            
                                
                
                protected abstract getNameOrPath(element: AstFile | AstFolder): void; // --------------------------------------------------------------------------------------------- +0.6 Complexity index (+0.6 atomic)
            
                            
                        
getStats Complexity Index 11.6 Cyclomatic complexity 2
                            
                                
                
            
            
                /**
                 * Calculates and returns all the statistics
                 * @param fileOrFolder      // The file or folder to analyse
                 */
                getStats(fileOrFolder: AstFile | AstFolder): Stats { // -------------------------------------------------------------------------------------------------------------- +0.6 Complexity index (+0.6 atomic)
                    if (this._stats) { // -------------------------------------------------------------------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                        return this._stats // ---------------------------------------------------------------------------------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                    } else { // ------------------------------------------------------------------------------------------------------------------------------------------------------ +1.1 Complexity index (+0.1 atomic, +1 structural)
                        this._stats = new Stats(); // -------------------------------------------------------------------------------------------------------------------------------- +0.5 Complexity index (+0.5 atomic)
                        this.calculateStats(fileOrFolder); // ------------------------------------------------------------------------------------------------------------------------ +1.3 Complexity index (+0.3 atomic, +1 structural)
                        this.getNameOrPath(fileOrFolder); // ------------------------------------------------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                        this._stats.setPercentages(); // ----------------------------------------------------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                        this._stats.totalCognitiveComplexity = fileOrFolder.cpxFactors.total; // ------------------------------------------------------------------------------------- +0.7 Complexity index (+0.7 atomic)
                        this._stats.totalCyclomaticComplexity = fileOrFolder.cyclomaticCpx; // --------------------------------------------------------------------------------------- +0.6 Complexity index (+0.6 atomic)
                        this.sortBarCharts(); // ------------------------------------------------------------------------------------------------------------------------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        return this._stats.plugChartHoles(); // ---------------------------------------------------------------------------------------------------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                    }
                }
            
                            
                        
sortBarCharts Complexity Index 3.7 Cyclomatic complexity 1
                            
                                
                
            
            
                /**
                 * Sorts the barCharts by increasing complexity
                 */
                sortBarCharts() { // ----------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                    this._stats.barChartCognitive = this._stats.barChartCognitive.sort(); // --------- +1.8 Complexity index (+0.8 atomic, +1 structural)
                    this._stats.barChartCyclomatic = this._stats.barChartCyclomatic.sort(); // ------- +1.8 Complexity index (+0.8 atomic, +1 structural)
                }