CodeCharmLtd/http-master

View on GitHub
src/HttpMasterWorker.js

Summary

Maintainability
F
3 days
Test Coverage

File HttpMasterWorker.js has 457 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';
var crypto = require('crypto');
var net = require('net');
var http = require('http');
var async = require('async');
Severity: Minor
Found in src/HttpMasterWorker.js - About 7 hrs to fix

    Function loadKeysforConfigEntry has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    function loadKeysforConfigEntry(config, callback) {
      var key;
      if(config.ssl === true) {
        config.ssl = {};
      }
    Severity: Minor
    Found in src/HttpMasterWorker.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 serverForPortConfig has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function serverForPortConfig(host, portNumber, portConfig) {
      var self = this;
      var server;
    
      self.cachedServers = self.cachedServers || {};
    Severity: Major
    Found in src/HttpMasterWorker.js - About 2 hrs to fix

      Function loadKeysforConfigEntry has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function loadKeysforConfigEntry(config, callback) {
        var key;
        if(config.ssl === true) {
          config.ssl = {};
        }
      Severity: Major
      Found in src/HttpMasterWorker.js - About 2 hrs to fix

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

        HttpMasterWorker.prototype.loadConfig = function(config, configLoaded) {
          var self = this;
        
          var events = new EventEmitter();
        
        
        Severity: Major
        Found in src/HttpMasterWorker.js - About 2 hrs to fix

          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 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 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 serverForPortConfig has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function serverForPortConfig(host, portNumber, portConfig) {
                  var self = this;
                  var server;
                
                  self.cachedServers = self.cachedServers || {};
                Severity: Minor
                Found in src/HttpMasterWorker.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 createHandlers has a Cognitive Complexity of 11 (exceeds 5 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

                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 lazyGetTcpServer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                function lazyGetTcpServer(port, host, cb) {
                  var tcpServers = this.tcpServers;
                
                  var entry = (host ? host + ':' + port : port);
                  if (tcpServers[entry]) {
                Severity: Minor
                Found in src/HttpMasterWorker.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 patchSslConfig has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                function patchSslConfig(portEntrySslConfig) {
                  if (nodeVersion >= 0.11) { // use fancy cipher settings only for 0.11
                    if (portEntrySslConfig.honorCipherOrder !== false) {
                      // prefer server ciphers over clients - prevents BEAST attack
                      portEntrySslConfig.honorCipherOrder = true;
                Severity: Minor
                Found in src/HttpMasterWorker.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 loadConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                HttpMasterWorker.prototype.loadConfig = function(config, configLoaded) {
                  var self = this;
                
                  var events = new EventEmitter();
                
                
                Severity: Minor
                Found in src/HttpMasterWorker.js - About 45 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

                There are no issues that match your filters.

                Category
                Status