dodekeract/symlinker

View on GitHub

Showing 14 of 18 total issues

Function runQueue has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

function runQueue () {
    queueRunning = true;

    console.log('runQueue: starting with ' + queue.length + ' tasks.');

Severity: Minor
Found in symlinker.js - About 1 day 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 runTasks has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

function runTasks (task, options) {
    for (var i = 0; i < task.length; i++) {
        var q = task[i];

        // checking if source folder is valid
Severity: Minor
Found in symlinker.js - About 4 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 runQueue has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function runQueue () {
    queueRunning = true;

    console.log('runQueue: starting with ' + queue.length + ' tasks.');

Severity: Major
Found in symlinker.js - About 3 hrs to fix

    File symlinker.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var mkdirp = require('mkdirp');
    
    var path = require('path');
    
    var fs = require('fs');
    Severity: Minor
    Found in symlinker.js - About 3 hrs to fix

      Function open has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function open (options) {
          var rawFile;
          // options:
          // -path
          // -type
      Severity: Major
      Found in symlinker.js - About 2 hrs to fix

        Function runTasks has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function runTasks (task, options) {
            for (var i = 0; i < task.length; i++) {
                var q = task[i];
        
                // checking if source folder is valid
        Severity: Minor
        Found in symlinker.js - About 1 hr to fix

          Function open has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function open (options) {
              var rawFile;
              // options:
              // -path
              // -type
          Severity: Minor
          Found in symlinker.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 basic has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function basic (sourcePath, destinationPath, options, callback) {
              try {
                  if (fs.lstatSync(destinationPath).isSymbolicLink()) {
                      if (!options.recreateSymbolicLinks) {
                          process.nextTick(function () {
          Severity: Minor
          Found in symlinker.js - About 1 hr to fix

            Function basic has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            function basic (sourcePath, destinationPath, options, callback) {
                try {
                    if (fs.lstatSync(destinationPath).isSymbolicLink()) {
                        if (!options.recreateSymbolicLinks) {
                            process.nextTick(function () {
            Severity: Minor
            Found in symlinker.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 (!options.forceRecreation) {
                                            console.log("Symbolic link " + outputPath  + " already exists.\nUse -r to force symbolic link recreation.");
                                            process.exit(1);
                                        } else {
                                            fs.unlinkSync(outputPath);
            Severity: Major
            Found in symlinker.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              for (var i = 0; i < currentTask.files.length; i++) {
                                  var currentFile = currentTask.files[i];
              
                                  var fileName = (currentFile.name) ? currentFile.name : currentFile.path;
              
              
              Severity: Major
              Found in symlinker.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if (!currentTask.options.recreateSymbolicLinks) { // not allowed to unlink symbolic links
                                        // process queue
                                        console.error('runQueue: error - destination is symlink', fileDestinationPath);
                                        currentTask.failed = true;
                                        currentTask.callback(new Error('Could not create symbolic link. Destination is already a symbolic link.'), null);
                Severity: Major
                Found in symlinker.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if (fileSourceStats.isDirectory()) {
                                          fs.symlinkSync(fileSourcePath, fileDestinationPath, 'dir');
                                      } else if (fileSourceStats.isFile()) {
                                          fs.symlinkSync(fileSourcePath, fileDestinationPath, 'file');
                                      } else {
                  Severity: Major
                  Found in symlinker.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    } else if (fileDestinationExisting) {
                                        if (!currentTask.options.ignoreExisting) {
                                            console.error('runQueue: error - file already existing', fileDestinationPath);
                                            currentTask.failed = true;
                                            currentTask.callback(new Error('Could not create symbolic link. Source file is invalid.'), null);
                    Severity: Major
                    Found in symlinker.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language