FrenchYeti/dexcalibur

View on GitHub
src/Utils.js

Summary

Maintainability
D
1 day
Test Coverage

Function makeTable has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    makeTable: function(array, fields){
        if(array.length == 0) return "";

        // filtre les colonnes
        let header = [], body=[], row={}, w=0, maxwidth={} ; 
Severity: Minor
Found in src/Utils.js - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File Utils.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const fs = require("fs");
const Process = require("child_process");
const Chalk = require("chalk");
const Path = require("path");
const crypto = require("crypto");
Severity: Minor
Found in src/Utils.js - About 2 hrs to fix

    Util has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    const Util = {
        ALPHA: 'abcdefghijklmnopqrstuvwxyz',
        ALPHANUM: 'abcdefghijklmnopqrstuvwxyz0123456789',
        FLAG_CR: FLAG_CR,
        FLAG_WS: FLAG_WS,
    Severity: Minor
    Found in src/Utils.js - About 2 hrs to fix

      Function makeTable has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          makeTable: function(array, fields){
              if(array.length == 0) return "";
      
              // filtre les colonnes
              let header = [], body=[], row={}, w=0, maxwidth={} ; 
      Severity: Minor
      Found in src/Utils.js - About 1 hr to fix

        Function isEmpty has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            isEmpty: function( pVar, pFlags=NO_FLAG){
                let f=null, p=null;
                switch(typeof pVar){
                    case 'array':
                        if(pFlags != null)
        Severity: Minor
        Found in src/Utils.js - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function forEachFileOf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            forEachFileOf: function(path,callback,isDir=false){
                let dir=null, elemnt=null, ret = null, smali=[], stat=fs.lstatSync(path);
        
                if(isDir || stat.isDirectory()){
                    dir=fs.readdirSync(path);
        Severity: Minor
        Found in src/Utils.js - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function download has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            download(pRemoteURL, pLocalPath, pCallbacks, pMode=0o666, pEncoding='binary'){
        Severity: Minor
        Found in src/Utils.js - About 35 mins to fix

          Function parseIPv4 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              parseIPv4: function( pAddress, pHasPortNumber=false){
                  const IPv4 = '(?<a>25[0–5]|2[0–4][0–9]|1[0-9]{2}|[0-9]{1,2})\.(?<b>25[0–5]|2[0–4][0–9]|1[0-9]{2}|[0-9]{1,2})\.(?<c>25[0–5]|2[0–4][0–9]|1[0-9]{2}|[0-9]{1,2})\.(?<d>25[0–5]|2[0–4][0–9]|1[0-9]{2}|[0-9]{1,2})';
                  const PORT ='(?<port>[0-9]{1,5})' 
          
                  if(pAddress == null) return { valid:false };
          Severity: Minor
          Found in src/Utils.js - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function trim has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              trim: function(str){
                  if(! str instanceof String) console.error("trim() : the argument must be a string");
          
                  while(str[0]!=undefined && (str[0]=="\t"||str[0]==" ")) 
                      str=str.substr(1);
          Severity: Minor
          Found in src/Utils.js - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          There are no issues that match your filters.

          Category
          Status