stpettersens/nodeGaudi

View on GitHub

Showing 5 of 5 total issues

Function cli has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

nodeGaudi.cli = function(args) {

    var action = "build"; // Default action to invoke is "build".

    /* Default behavior is to build a project following
Severity: Minor
Found in lib/NodeGaudiApp.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

Function doCommand has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function doCommand(command, param) {
    printCommand(command, param);
    switch(command) {
        case "doAction":
            execExtern("./nodeGaudi " + param);
Severity: Minor
Found in lib/NodeGaudiBuilder.js - About 1 hr to fix

    Function eraseFile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    function eraseFile(file, executable) {
        //g.println(habitat.getOSFamily());
        if(fs.lstatSync(file).isFile()) {
            try {
                if(executable && habitat.getOSFamily() === 0) {
    Severity: Minor
    Found in lib/NodeGaudiBuilder.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

    Avoid deeply nested control flow statements.
    Open

                        if(args[i+2] !== null) { action = args[i+2]; }
    Severity: Major
    Found in lib/NodeGaudiApp.js - About 45 mins to fix

      Function doAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      NodeGaudiBuilder.doAction = function(action) {
          self.action_start = now();
          g.println(colors.yellow("[ " + self.target + " => " + self.actionName + " ]"));
          for(var i = 0; i < action.length; i++) {
              var command = action[i];
      Severity: Minor
      Found in lib/NodeGaudiBuilder.js - About 25 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

      Severity
      Category
      Status
      Source
      Language