JamesonNetworks/Nirodha

View on GitHub

Showing 29 of 42 total issues

Avoid deeply nested control flow statements.
Open

                if(typeof(callback) !== 'undefined') {
                    callback(null, testing.nirodhaManager.notfound);
                }
Severity: Major
Found in bin/server.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            for(var l = 0; l < libraries[i][k].fileNames.length; l++) {
                                if(typeof(libraryContainer[libraries[i][k].fileNames[l]]) === 'undefined') {
                                    libraryContainer[libraries[i][k].fileNames[l]] = {};
                                    libraryContainer[libraries[i][k].fileNames[l]].dir = libraries[i][k].dir;                                
                                }
    Severity: Major
    Found in bin/libraryManager.js - About 45 mins to fix

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

      function handleRequest (req, res, rootDirectory, htmlFiles, callback) {
      Severity: Minor
      Found in bin/server.js - About 35 mins to fix

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

        Util.prototype.hasDuplicateLibraries = function(libraries) {
          logger.debug('Libraries is: ' + JSON.stringify(libraries));
          var librariesByName = [];
          for(var i = 0; i < libraries.length; i++) {
            for(var k = 0; k < libraries[i].length; k++) {
        Severity: Minor
        Found in bin/utilities.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 getLibraries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function getLibraries(cwd, type, include, callback) {
            
            process.chdir(cwd);
            logger.debug('Entering loop to add ' + type + ' libraries');
            var files = include.libs[type];
        Severity: Minor
        Found in bin/view.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 generateIncludes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function generateIncludes(libobject, type) {
            var files = libobject.libs[type];
        
            logger.log('Generating includes...', 7);
            logger.log('Library lengths: ' + files.length, 7);
        Severity: Minor
        Found in bin/view.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 _deploy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        NirodhaManager.prototype._deploy = function(minify, settings, viewname, callback) {
            var views = [];
            if(typeof(viewname) === 'undefined') {
        
                logger.debug('No viewname specified!');
        Severity: Minor
        Found in bin/nirodhaManager.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

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

        Util.prototype.getDuplicateLibraries = function(libraries) {
          var librariesByName = [];
          for(var i = 0; i < libraries.length; i++) {
            for(var k = 0; k < libraries[i].length; k++) {
              logger.debug('Libraries in loop: ' + JSON.stringify(libraries[i][k].fileNames));
        Severity: Minor
        Found in bin/utilities.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

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

        function findFiles(resultFileList, filter) {
          var returnableFiles = "";
          for(var i = 0; i < resultFileList.length; i++) {
            if(typeof(resultFileList[i].fileNames) !== 'undefined') {
              if(resultFileList[i].fileNames.filter(filter).length > 0) {
        Severity: Minor
        Found in bin/utilities.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