encharm/http-master

View on GitHub

Showing 69 of 71 total issues

Function LogFileService has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function LogFileService(config, commService, master, worker) {

  var comm = commService('logFile');

  var logFileHandlers = {};
Severity: Major
Found in modules/services/logFile.js - About 2 hrs to fix

    File certScanner.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var x509 = require('x509.js');
    var fs = require('fs');
    var async = require('async');
    Severity: Minor
    Found in src/certScanner.js - About 2 hrs to fix

      Function DispatchTable has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function DispatchTable(port, params) {
        var parseEntry = params.entryParser;
        var config = params.config;
      
        var self = this;
      Severity: Major
      Found in src/DispatchTable.js - About 2 hrs to fix

        Function reload has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        HttpMaster.prototype.reload = function(config, reloadDone) {
          var self = this;
          this.emit('reload');
        
          function actualReload(config) {
        Severity: Major
        Found in src/HttpMaster.js - About 2 hrs to fix

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

          HttpMaster.prototype.init = function(config, initDone) {
            var self = this;
            var workers = this.workers;
          
            function actualInit(config) {
          Severity: Minor
          Found in src/HttpMaster.js - About 2 hrs to fix

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

            module.exports = function RejectMiddleware(config, portConfig) {
              var content;
              var errorHtmlFile = portConfig.errorHtmlFile || config.errorHtmlFile;
              if(errorHtmlFile) {
                if(typeof errorHtmlFile === 'function') {
            Severity: Minor
            Found in modules/middleware/reject.js - About 1 hr to fix

              Function LogFileService has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function LogFileService(config, commService, master, worker) {
              
                var comm = commService('logFile');
              
                var logFileHandlers = {};
              Severity: Minor
              Found in modules/services/logFile.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 handleConfigEntryAfterLoadingKeys has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function handleConfigEntryAfterLoadingKeys(host, portNumber, config, callback) {
                var self = this;
              
                var handlers = createHandlers.call(this, portNumber, config);
              
              
              Severity: Minor
              Found in src/HttpMasterWorker.js - About 1 hr to fix

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

                DispatchTable.prototype.getTargetForReq = function(req) {
                  var i, m;
                  var host = req.unicodeHost || req.headers.host || ''; // host can be undefined
                
                  var self = this;
                Severity: Minor
                Found in src/DispatchTable.js - About 1 hr to fix

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

                    function actualReload(config) {
                      self.config = config;
                      var workers = self.workers;
                  
                      setupDi.call(self);
                  Severity: Minor
                  Found in src/HttpMaster.js - About 1 hr to fix

                    Function actualInit has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function actualInit(config) {
                        self.config = config;
                    
                        setupDi.call(self);
                    
                    
                    Severity: Minor
                    Found in src/HttpMaster.js - About 1 hr to fix

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

                      function createHandlers(portNumber, portConfig) {
                        var self = this;
                      
                        var di = this.di.makeChild();
                        di.bindInstance('di', di);
                      Severity: Minor
                      Found in src/HttpMasterWorker.js - About 1 hr to fix

                        Function LetsEncrypt has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = function LetsEncrypt(commService, master, worker, moduleConfig, config) {
                          let comm = commService('letsencrypt');
                          let Promise = require('bluebird');
                          let tls = require('tls');
                        
                        
                        Severity: Minor
                        Found in modules/letsencrypt.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 preprocessPortConfig has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function preprocessPortConfig(config, cb) {
                          var self = this;
                          if (config.ssl) {
                        
                            var loadsToDo = [];
                        Severity: Minor
                        Found in src/HttpMaster.js - About 1 hr to fix

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

                          function initWorker(cb) {
                            var self = this;
                            var worker = this.cluster.fork();
                            worker.sendMessage = function(type, data) {
                              worker.send(JSONfn.stringify({
                          Severity: Minor
                          Found in src/HttpMaster.js - About 1 hr to fix

                            Function handleConfig has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function handleConfig(config, configHandled) {
                              var self = this;
                            
                              self.config = config;
                            
                            
                            Severity: Minor
                            Found in src/HttpMasterWorker.js - About 1 hr to fix

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

                              module.exports = function WebsockifyService() {
                                var wsServer = new WebSocketServer({
                                  server: new EventEmitter() // fake server for web socket server
                                })
                                return function(req, socket, cb) {
                              Severity: Minor
                              Found in modules/services/websockify.js - About 1 hr to fix

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

                                function bindTypeGeneric(doCache, name, type) {
                                  // implicit name from function name
                                  if(typeof name === 'function') {
                                    type = name;
                                    var constructorName = functionName(type);
                                Severity: Minor
                                Found in src/di.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 resolve has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                DI.prototype.resolve = function(obj, overrides) {
                                  var dependencyMap = extend({}, this.mapping, overrides);
                                  var args;
                                  var resolved;
                                
                                
                                Severity: Minor
                                Found in src/di.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 setupDi has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function setupDi() {
                                  var self = this;
                                  var di = this.di = new DI();
                                  di.onMissing = function(name) {
                                    var m;
                                Severity: Minor
                                Found in src/HttpMaster.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language