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');
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 = {};
}
- Read upRead up
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;
Function scan
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
scan(cb) {
var outputConfig = {};
var keys = {};
var certs = {};
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');
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');
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;
- Read upRead up
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) => {
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');
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) {
- Read upRead up
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;
- Read upRead up
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() {};
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;
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') {
- Read upRead up
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 || {};
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) {
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 = {};
}
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;
- Read upRead up
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;
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();