lib/_http_server.js

Summary

Maintainability
F
3 days
Test Coverage

Function connectionListener has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

function connectionListener(socket) {
  var self = this;
  var outgoing = [];
  var incoming = [];

Severity: Minor
Found in lib/_http_server.js - About 1 day 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 connectionListener has 157 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function connectionListener(socket) {
  var self = this;
  var outgoing = [];
  var incoming = [];

Severity: Major
Found in lib/_http_server.js - About 6 hrs to fix

    File _http_server.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
    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
    Severity: Minor
    Found in lib/_http_server.js - About 4 hrs to fix

      Function writeHead has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      ServerResponse.prototype.writeHead = function(statusCode, reason, obj) {
        var headers;
      
        if (util.isString(reason)) {
          // writeHead(statusCode, reasonPhrase[, headers])
      Severity: Minor
      Found in lib/_http_server.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 parserOnIncoming has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      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
      Severity: Minor
      Found in lib/_http_server.js - About 1 hr to fix

        Function writeHead has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        ServerResponse.prototype.writeHead = function(statusCode, reason, obj) {
          var headers;
        
          if (util.isString(reason)) {
            // writeHead(statusCode, reasonPhrase[, headers])
        Severity: Minor
        Found in lib/_http_server.js - About 1 hr to fix

          Function socketOnData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function socketOnData(d) {
              assert(!socket._paused);
              debug('SERVER socketOnData %d', d.length);
              var ret = parser.execute(d);
              if (ret instanceof Error) {
          Severity: Minor
          Found in lib/_http_server.js - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status