Genese complexity report

<- json-ast-to-reports.ts
Methods : 3
Complexity index : 20.9
Cyclomatic complexity : 5
Cognitive complexity
66.7 % Correct 2/3
33.3 % Warning 1/3 (threshold : 10)
0 % Error 0/3 (threshold : 20)
Cyclomatic complexity
100 % Correct 3/3
0 % Warning 0/3 (threshold : 5)
0 % Error 0/3 (threshold : 10)
Methods of json-ast-to-reports.ts
start Complexity Index 15.5 Cyclomatic complexity 3
                            
                                
                
            
                /**
                 * Starts the analysis
                 * @param pathCommand
                 * @param jsonAstPath
                 * @param markdown
                 * @param consoleMode
                 */
                static start(pathCommand: string, jsonAstPath = '/json-ast.json', markdown: boolean, consoleMode: boolean): any { // -------------------- +0.8 Complexity index (+0.8 atomic)
                    let result = undefined; // ---------------------------------------------------------------------------------------------------------- +0.3 Complexity index (+0.3 atomic)
                    const jsonAst = new InitService().generateAllFromJsonAst(JsonAstToReports.getJsonAst(pathCommand + jsonAstPath)); // ---------------- +3.0 Complexity index (+1.0 atomic, +2 structural)
                    jsonAst.astFolder.evaluate(); // ---------------------------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    if(markdown){ // -------------------------------------------------------------------------------------------------------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        ReportsService.generateMarkdownReports(jsonAst) // ------------------------------------------------------------------------------ +1.3 Complexity index (+0.3 atomic, +1 structural)
                    } else if (consoleMode) { // -------------------------------------------------------------------------------------------------------- +1.2 Complexity index (+0.2 atomic, +1 structural)
                        result = ReportsService.generateConsoleReports(jsonAst) // ---------------------------------------------------------------------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                    } else { // ------------------------------------------------------------------------------------------------------------------------- +1.1 Complexity index (+0.1 atomic, +1 structural)
                        ReportsService.generateAllReports(jsonAst) // ----------------------------------------------------------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                        const link = terminalLink('folder-report.html', `file://${pathCommand}/genese/complexity/reports/folder-report.html`); // ------- +1.5 Complexity index (+0.5 atomic, +1 structural)
                        result = `Please open in your browser the file "${link}" located in your genese reports folder.` // ----------------------------- +0.3 Complexity index (+0.3 atomic)
                    }
                    this.astFolder = jsonAst.astFolder; // ---------------------------------------------------------------------------------------------- +0.5 Complexity index (+0.5 atomic)
                    return result; // ------------------------------------------------------------------------------------------------------------------- +0.2 Complexity index (+0.2 atomic)
                }
            
                            
                        
getTotalCpx Complexity Index 3.7 Cyclomatic complexity 1
                            
                                
                
            
            
                /**
                 * Get the complexity value of the given JsonAst
                 * @param jsonAst
                 * @returns {number}
                 */
                static getTotalCpx(jsonAst: JsonAst): number { // ---------------------------- +0.3 Complexity index (+0.3 atomic)
                    const json = new InitService().generateAllFromJsonAst(jsonAst); // ------- +1.6 Complexity index (+0.6 atomic, +1 structural)
                    json.astFolder.evaluateStandalone(); // ---------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                    return json.astFolder.stats.totalCognitiveComplexity; // ----------------- +0.5 Complexity index (+0.5 atomic)
                }
            
                            
                        
getJsonAst Complexity Index 1.7 Cyclomatic complexity 1
                            
                                
                
            
                /**
                 * Returns the content of the JsonAst file
                 * @param jsonAstPath
                 */
                private static getJsonAst(jsonAstPath: string): JsonAst { // ------- +0.4 Complexity index (+0.4 atomic)
                    return require(jsonAstPath); // -------------------------------- +1.3 Complexity index (+0.3 atomic, +1 structural)
                }