JamesonNetworks/Nirodha

View on GitHub

Showing 29 of 42 total issues

File view.js has 351 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var fs = require('fs');
var logger = require('jslogging');
var async = require('async');
var compressor = require('node-minify');

Severity: Minor
Found in bin/view.js - About 4 hrs to fix

    Function handleRequest has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    function handleRequest (req, res, rootDirectory, htmlFiles, callback) {
        logger.debug('req.url: ' + req.url);
        // Parse the request url
        var URI = req.url.substring(1, req.url.length);
        logger.log('Requested URI is: ' + URI, 7);
    Severity: Minor
    Found in bin/server.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 generateSupportFilesForDeploy has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    View.prototype.generateSupportFilesForDeploy = function(type, minify, callback) {
        
        var viewHandle = this;
        if(typeof(this.includes) === 'undefined') {
            throw new Error('Includes was undefined');
    Severity: Minor
    Found in bin/view.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 handleRequest has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function handleRequest (req, res, rootDirectory, htmlFiles, callback) {
        logger.debug('req.url: ' + req.url);
        // Parse the request url
        var URI = req.url.substring(1, req.url.length);
        logger.log('Requested URI is: ' + URI, 7);
    Severity: Major
    Found in bin/server.js - About 3 hrs to fix

      Function create has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      View.prototype.create = function(callback) {
          var viewname = this.name;
          if(typeof(this.name) === 'undefined' || this.name === '') {
              throw new Error('No view name, did you call view.init with a name?');
          }
      Severity: Minor
      Found in bin/view.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 create has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      View.prototype.create = function(callback) {
          var viewname = this.name;
          if(typeof(this.name) === 'undefined' || this.name === '') {
              throw new Error('No view name, did you call view.init with a name?');
          }
      Severity: Major
      Found in bin/view.js - About 3 hrs to fix

        Function generateSupportFilesForDeploy has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        View.prototype.generateSupportFilesForDeploy = function(type, minify, callback) {
            
            var viewHandle = this;
            if(typeof(this.includes) === 'undefined') {
                throw new Error('Includes was undefined');
        Severity: Major
        Found in bin/view.js - About 2 hrs to fix

          Function init has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          LibraryManager.prototype.init = function() {
          
              //debugger;
              if(typeof(this.includes) === 'undefined') {
                  this.includes = [];
          Severity: Minor
          Found in bin/libraryManager.js - About 1 hr to fix

            Function exports has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function (args, settings) {
                var nm = require('./nirodhaManager.js');
                nm.setSettings(settings);
            
                var rootDirectory;
            Severity: Minor
            Found in bin/start.js - About 1 hr to fix

              Function insertLibrariesAt has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function insertLibrariesAt(text, libobject, callback) {
              
                  // logger.log('text dump: ' + JSON.stringify(text));
                  logger.debug('libobject dump: ' + JSON.stringify(libobject));
                  var start = text.indexOf(libobject.title);
              Severity: Minor
              Found in bin/server.js - About 1 hr to fix

                Function parse has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function parse(res, directory, view, callback) {
                    /*
                    *   Parse the libraries included in the thtml
                    */
                    logger.debug('Directory: ' + directory);
                Severity: Minor
                Found in bin/server.js - About 1 hr to fix

                  Function _deploy has 43 lines of code (exceeds 25 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 1 hr to fix

                    Function MinifyFile has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            MinifyFile: function(cb) {
                                var include;
                                var includeTitle;
                    
                                var inPath;
                    Severity: Minor
                    Found in bin/view.js - About 1 hr to fix

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

                      module.exports = function (args, settings, callback) {
                          logger.debug('Entering create...', 6);
                          logger.debug('Args: ' + JSON.stringify(args));
                          logger.debug('Settings: ' + JSON.stringify(settings));
                      
                      
                      Severity: Minor
                      Found in bin/create.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 serveLibrary has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      LibraryManager.prototype.serveLibrary = function(uri, res, callback) {
                          var type = uri.indexOf('js') > 0 ? 'js' : 'css';
                          getLibraryContents(uri, function(pageText, found) {
                              if(found) {
                                  if(type === 'js') {
                      Severity: Minor
                      Found in bin/libraryManager.js - About 1 hr to fix

                        Function exports has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function (args, settings, callback) {
                            logger.debug('Entering create...', 6);
                            logger.debug('Args: ' + JSON.stringify(args));
                            logger.debug('Settings: ' + JSON.stringify(settings));
                        
                        
                        Severity: Minor
                        Found in bin/create.js - About 1 hr to fix

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

                          function walkSync (start, callback) {
                            if(fs.existsSync(start)) {
                              var stat = fs.statSync(start);
                          
                              if (stat.isDirectory()) {
                          Severity: Minor
                          Found in bin/utilities.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 exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function () {
                          
                              var wm = require('./watchManager.js');
                          
                              var callback = function() {
                          Severity: Minor
                          Found in bin/watch.js - About 1 hr to fix

                            Function copyStaticFiles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            View.prototype.copyStaticFiles = function(callback) {
                                var staticDirectory = 'custom/static';
                                utils.walkSync(staticDirectory, function(dir, directories, fileNames) {
                                    logger.debug('Directory: ' + dir);
                                    logger.debug('FileNames: ' + JSON.stringify(fileNames));
                            Severity: Minor
                            Found in bin/view.js - About 1 hr to fix

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

                              var getLibraryContents = function(uri, callback) {
                                  logger.debug('Entering getLibraryContents...');
                                  logger.debug(JSON.stringify(Libraries));
                                  if(typeof(Libraries) === 'undefined') {
                                      throw new Error('No libraries defined, did you call LibraryManager.init first?');
                              Severity: Minor
                              Found in bin/libraryManager.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

                              Severity
                              Category
                              Status
                              Source
                              Language