encharm/http-master

View on GitHub

Showing 69 of 71 total issues

Function serviceFunction has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var serviceFunction = function(logFile) {
      if(logFileHandlers[logFile])
        return logFileHandlers[logFile];

      var watch;
Severity: Minor
Found in modules/services/logFile.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 checkPathForReq has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    DispatchTable.prototype.checkPathForReq = function(req, entry) {
      if(!entry.path)
        return true;
      var m;
    
    
    Severity: Minor
    Found in src/DispatchTable.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 bindTypeGeneric has 34 lines of code (exceeds 25 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

      Function processDirectory has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              let processDirectory = (dirName, cb) => {
                fs.readdir(dirName, (err, files) => {
      
                  if(err) return cb(err);
      
      
      Severity: Minor
      Found in src/certScanner.js - About 1 hr to fix

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

        function dropPrivileges() {
          var strInfo;
          if (process.setgid) {
            var group = config.group;
            if (typeof group === 'string') {
        Severity: Minor
        Found in src/worker.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 WebsockifyMiddleware has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function WebsockifyMiddleware() {
          return {
            requestHandler: function(req, res, next, parsedEntry) {
              if(req.upgrade) {
                var socket = new net.Socket();
        Severity: Minor
        Found in modules/middleware/websockify.js - About 1 hr to fix

          Function Logging has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function Logging(logFileService, master, moduleConfig) {
            var appStream;
            if(!master)
              return;
          
          
          Severity: Minor
          Found in modules/appLog.js - About 1 hr to fix

            Function requestHandler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                requestHandler: function(req, res, next, dispatchTarget) {
                  req.next = next;
                  // workaround for node-http-proxy/#591
                  if(!req.headers.host) {
                    req.headers.host = '';
            Severity: Minor
            Found in modules/middleware/proxy.js - About 1 hr to fix

              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 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 resolve has 27 lines of code (exceeds 25 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

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

                function processMatch(target, m) {
                  var keyWithOffset;
                  if (m) {
                    for(var key in m) {
                      var replaceFrom = key;
                Severity: Minor
                Found in src/regexpHelper.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

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

                module.exports = function WebsockifyMiddleware() {
                  return {
                    requestHandler: function(req, res, next, parsedEntry) {
                      if(req.upgrade) {
                        var socket = new net.Socket();
                Severity: Minor
                Found in modules/middleware/websockify.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

                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

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

                module.exports = function(argv, data, cb) {
                
                  var oldWarn = console.warn;
                  console.warn = function() {};
                
                
                Severity: Minor
                Found in migrateV1Config.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 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 exports has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                module.exports = function LetsEncrypt(commService, master, worker, moduleConfig, config) {
                Severity: Minor
                Found in modules/letsencrypt.js - About 35 mins to fix

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

                  function getRegexpIfNeeded(str, specialCh, optionalEnding) {
                    if (typeof str == 'string') {
                      var m = str.match(/^\^(.*)\$?$/);
                      if (m) {
                        return new XRegExp('^' + m[1] + (optionalEnding?('(?:'+optionalEnding+')?'):'') +  '$');
                  Severity: Minor
                  Found in src/DispatchTable.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

                  Severity
                  Category
                  Status
                  Source
                  Language