CodeCharmLtd/http-master

View on GitHub
src/HttpMaster.js

Summary

Maintainability
D
2 days
Test Coverage

File HttpMaster.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var async = require('async');

var EventEmitter = require('eventemitter3');
var path = require('path');
var CertScanner = require('./certScanner');
Severity: Minor
Found in src/HttpMaster.js - About 3 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 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 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 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

                  Function reload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  HttpMaster.prototype.reload = function(config, reloadDone) {
                    var self = this;
                    this.emit('reload');
                  
                    function actualReload(config) {
                  Severity: Minor
                  Found in src/HttpMaster.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

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

                  function preprocessPortConfig(config, cb) {
                    var self = this;
                    if (config.ssl) {
                  
                      var loadsToDo = [];
                  Severity: Minor
                  Found in src/HttpMaster.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 setupDi has a Cognitive Complexity of 7 (exceeds 5 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 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 init has a Cognitive Complexity of 6 (exceeds 5 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 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

                  There are no issues that match your filters.

                  Category
                  Status