lib/_http_server.js
Function connectionListener
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
Open
function connectionListener(socket) {
var self = this;
var outgoing = [];
var incoming = [];
- 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 connectionListener
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function connectionListener(socket) {
var self = this;
var outgoing = [];
var incoming = [];
File _http_server.js
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Function writeHead
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
ServerResponse.prototype.writeHead = function(statusCode, reason, obj) {
var headers;
if (util.isString(reason)) {
// writeHead(statusCode, reasonPhrase[, headers])
- 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 parserOnIncoming
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parserOnIncoming(req, shouldKeepAlive) {
incoming.push(req);
// If the writable end isn't consuming, then stop reading
// so that we don't become overwhelmed by a flood of
Function writeHead
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ServerResponse.prototype.writeHead = function(statusCode, reason, obj) {
var headers;
if (util.isString(reason)) {
// writeHead(statusCode, reasonPhrase[, headers])
Function socketOnData
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function socketOnData(d) {
assert(!socket._paused);
debug('SERVER socketOnData %d', d.length);
var ret = parser.execute(d);
if (ret instanceof Error) {