CodeCharmLtd/http-master

View on GitHub

Showing 71 of 71 total issues

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 constructor has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor(sslDirectory, options) {
        super();
        
        this.options = options;
        
    Severity: Major
    Found in src/certScanner.js - About 4 hrs to fix

      Function scan has 104 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        scan(cb) {
          var outputConfig = {};
      
          var keys = {};
          var certs = {};
      Severity: Major
      Found in src/certScanner.js - About 4 hrs to fix

        Function LetsEncrypt has 94 lines of code (exceeds 25 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: Major
        Found in modules/letsencrypt.js - About 3 hrs to fix

          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 getTargetForReq has a Cognitive Complexity of 22 (exceeds 5 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 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 processDirectory has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                let processDirectory = (dirName, cb) => {
                  fs.readdir(dirName, (err, files) => {
                    if(err) return cb(err);
            
                    async.each(files, (certFile, cb) => {
            Severity: Major
            Found in src/certScanner.js - About 3 hrs to fix

              Function CommService has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function CommService(events, master, worker) {
                let processListeners = [];
                let Promise = require('bluebird');
                let controller = master?master:worker;
                let uuid = require('uuid');
              Severity: Major
              Found in modules/services/comm.js - About 2 hrs to fix

                Function ProxyMiddleware has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function ProxyMiddleware(config, portConfig, di) {
                  var {httpAgent, httpsAgent} = getAgent(config, portConfig);
                  var proxyHttp = httpProxy.createProxyServer({xfwd: true, agent: httpAgent});
                  var proxyHttps = httpProxy.createProxyServer({xfwd: true, agent: httpsAgent, secure: false});
                  proxyHttp.on('error', function(err, req, res) {
                Severity: Minor
                Found in modules/middleware/proxy.js - About 2 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 constructor has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                  constructor(sslDirectory, options) {
                    super();
                    
                    this.options = options;
                    
                Severity: Minor
                Found in src/certScanner.js - About 2 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 exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function(argv, data, cb) {
                
                  var oldWarn = console.warn;
                  console.warn = function() {};
                
                
                Severity: Major
                Found in migrateV1Config.js - About 2 hrs to fix

                  Function RouterMiddleware has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function RouterMiddleware(di, portConfig, portNumber) {
                  
                  
                    function passEntryToModuleInstance(instance, entry) {
                      var dispatchTarget = entry;
                  Severity: Major
                  Found in modules/middleware/router.js - About 2 hrs to fix

                    Function RejectMiddleware has a Cognitive Complexity of 19 (exceeds 5 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 2 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 ProxyMiddleware has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = function ProxyMiddleware(config, portConfig, di) {
                        var {httpAgent, httpsAgent} = getAgent(config, portConfig);
                        var proxyHttp = httpProxy.createProxyServer({xfwd: true, agent: httpAgent});
                        var proxyHttps = httpProxy.createProxyServer({xfwd: true, agent: httpsAgent, secure: false});
                        proxyHttp.on('error', function(err, req, res) {
                      Severity: Major
                      Found in modules/middleware/proxy.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 RouterMiddleware has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports = function RouterMiddleware(di, portConfig, portNumber) {
                          
                          
                            function passEntryToModuleInstance(instance, entry) {
                              var dispatchTarget = entry;
                          Severity: Minor
                          Found in modules/middleware/router.js - About 2 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 getCaFor has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              this.getCaFor = async.memoize((certPath, cb) => {
                                this.readPart(certPath, 65636, (err, rawCert) => {
                                  if(err) return cb(err);
                          
                                  var parsedCert;
                          Severity: Major
                          Found in src/certScanner.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
                              Severity
                              Category
                              Status
                              Source
                              Language