Genese complexity report

<- ast-file.service.ts
Methods : 5
Complexity index : 19
Cyclomatic complexity : 6
Cognitive complexity
100 % Correct 5/5
0 % Warning 0/5 (threshold : 10)
0 % Error 0/5 (threshold : 20)
Cyclomatic complexity
100 % Correct 5/5
0 % Warning 0/5 (threshold : 5)
0 % Error 0/5 (threshold : 10)
Methods of ast-file.service.ts
Complexity Index 1 Cyclomatic complexity 0
                            
                                
                
            
            
                constructor() {
                    super(); // ----------------------------------------------------------------------------------------------------------- +1.0 Complexity index (+0.0 atomic, +1 structural)
                }
            
                            
                        
calculateStats Complexity Index 4 Cyclomatic complexity 3
                            
                                
                
            
            
                /**
                 * Calculates the statistics of the AstFile
                 * @param astFile    // The AstFile to analyse
                 */
                calculateStats(astFile: AstFile): void { // --------------------------------- +0.4 Complexity index (+0.4 atomic)
                    this._stats.numberOfMethods = astFile.astMethods?.length ?? 0; // ------- +0.9 Complexity index (+0.9 atomic)
                    for (const method of astFile.astMethods) { // --------------------------- +1.4 Complexity index (+0.4 atomic, +1 structural)
                        this.incrementStats(method); // ------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    }
                }
            
                            
                        
incrementStats Complexity Index 6.6 Cyclomatic complexity 1
                            
                                
                
            
            
                /**
                 * Increments AstFile statistics for a given method
                 * @param astMethod    // The AstMethod to analyse
                 */
                incrementStats(astMethod: AstMethod): void { // ---------------------------------------- +0.4 Complexity index (+0.4 atomic)
                    this.incrementStatsMethodsByStatus(astMethod, ComplexityType.COGNITIVE); // -------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                    this.incrementStatsMethodsByStatus(astMethod, ComplexityType.CYCLOMATIC); // ------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                    this._stats.barChartCognitive.addResult(astMethod.cpxIndex); // -------------------- +1.6 Complexity index (+0.6 atomic, +1 structural)
                    this._stats.barChartCyclomatic.addResult(astMethod.cyclomaticCpx); // -------------- +1.6 Complexity index (+0.6 atomic, +1 structural)
                }
            
                            
                        
incrementStatsMethodsByStatus Complexity Index 6.4 Cyclomatic complexity 1
                            
                                
                
            
            
                /**
                 * Increments the number of methods spread by Status (correct, warning, error) and by complexity type
                 * @param astMethod        // The AstMethod to analyse
                 * @param type              // The complexity type
                 */
                incrementStatsMethodsByStatus(astMethod: AstMethod, type: ComplexityType): void { // -------------------------------------- +0.6 Complexity index (+0.6 atomic)
                    const status = (type === ComplexityType.COGNITIVE) ? astMethod.cognitiveStatus : astMethod.cyclomaticStatus; // ------- +2.1 Complexity index (+1.1 atomic, +1 structural)
                    switch (status) { // -------------------------------------------------------------------------------------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        case MethodStatus.CORRECT: // ------------------------------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                            this._stats.numberOfMethodsByStatus[type].correct ++; // ------------------------------------------------------ +0.5 Complexity index (+0.5 atomic)
                            break;
                        case MethodStatus.ERROR: // --------------------------------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                            this._stats.numberOfMethodsByStatus[type].error ++; // -------------------------------------------------------- +0.5 Complexity index (+0.5 atomic)
                            break;
                        case MethodStatus.WARNING: // ------------------------------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                            this._stats.numberOfMethodsByStatus[type].warning ++; // ------------------------------------------------------ +0.5 Complexity index (+0.5 atomic)
                            break;
                        default: // ------------------------------------------------------------------------------------------------------- +0.1 Complexity index (+0.1 atomic)
                            break;
                    }
                }
            
                            
                        
getNameOrPath Complexity Index 1 Cyclomatic complexity 1
                            
                                
                
            
            
                /**
                 * Adds the filename to the stats
                 */
                getNameOrPath(astFile: AstFile): void { // ------- +0.4 Complexity index (+0.4 atomic)
                    this._stats.subject = astFile.name; // ------- +0.6 Complexity index (+0.6 atomic)
                }