enclose-io/compiler

View on GitHub
lts/lib/_http_server.js

Summary

Maintainability
F
2 wks
Test Coverage

File _http_server.js has 636 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: Major
Found in lts/lib/_http_server.js - About 1 day to fix

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

    function writeHead(statusCode, reason, obj) {
      const originalStatusCode = statusCode;
    
      statusCode |= 0;
      if (statusCode < 100 || statusCode > 999) {
    Severity: Minor
    Found in lts/lib/_http_server.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 parserOnIncoming has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    function parserOnIncoming(server, socket, state, req, keepAlive) {
      resetSocketTimeout(server, socket, state);
    
      if (server.keepAliveTimeout > 0) {
        req.on('end', resetHeadersTimeoutOnReqEnd);
    Severity: Minor
    Found in lts/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 connectionListenerInternal has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function connectionListenerInternal(server, socket) {
      debug('SERVER new http connection');
    
      // Ensure that the server property of the socket is correctly set.
      // See https://github.com/nodejs/node/issues/13435
    Severity: Major
    Found in lts/lib/_http_server.js - About 2 hrs to fix

      Function parserOnIncoming has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function parserOnIncoming(server, socket, state, req, keepAlive) {
        resetSocketTimeout(server, socket, state);
      
        if (server.keepAliveTimeout > 0) {
          req.on('end', resetHeadersTimeoutOnReqEnd);
      Severity: Minor
      Found in lts/lib/_http_server.js - About 2 hrs to fix

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

        function writeHead(statusCode, reason, obj) {
          const originalStatusCode = statusCode;
        
          statusCode |= 0;
          if (statusCode < 100 || statusCode > 999) {
        Severity: Minor
        Found in lts/lib/_http_server.js - About 1 hr to fix

          Function resOnFinish has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function resOnFinish(req, res, socket, state, server) {
            // Usually the first incoming element should be our request.  it may
            // be that in the case abortIncoming() was called that the incoming
            // array will be empty.
            assert(state.incoming.length === 0 || state.incoming[0] === req);
          Severity: Minor
          Found in lts/lib/_http_server.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 onParserExecuteCommon has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function onParserExecuteCommon(server, socket, parser, state, ret, d) {
            resetSocketTimeout(server, socket, state);
          
            if (ret instanceof Error) {
              prepareError(ret, parser, d);
          Severity: Minor
          Found in lts/lib/_http_server.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 onParserExecuteCommon has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function onParserExecuteCommon(server, socket, parser, state, ret, d) {
            resetSocketTimeout(server, socket, state);
          
            if (ret instanceof Error) {
              prepareError(ret, parser, d);
          Severity: Minor
          Found in lts/lib/_http_server.js - About 1 hr to fix

            Function Server has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Server(options, requestListener) {
              if (!(this instanceof Server)) return new Server(options, requestListener);
            
              if (typeof options === 'function') {
                requestListener = options;
            Severity: Minor
            Found in lts/lib/_http_server.js - About 1 hr to fix

              Function onParserExecuteCommon has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function onParserExecuteCommon(server, socket, parser, state, ret, d) {
              Severity: Minor
              Found in lts/lib/_http_server.js - About 45 mins to fix

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

                function Server(options, requestListener) {
                  if (!(this instanceof Server)) return new Server(options, requestListener);
                
                  if (typeof options === 'function') {
                    requestListener = options;
                Severity: Minor
                Found in lts/lib/_http_server.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 resOnFinish has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function resOnFinish(req, res, socket, state, server) {
                Severity: Minor
                Found in lts/lib/_http_server.js - About 35 mins to fix

                  Function parserOnIncoming has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function parserOnIncoming(server, socket, state, req, keepAlive) {
                  Severity: Minor
                  Found in lts/lib/_http_server.js - About 35 mins to fix

                    Function socketOnData has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function socketOnData(server, socket, parser, state, d) {
                    Severity: Minor
                    Found in lts/lib/_http_server.js - About 35 mins to fix

                      Function onParserExecute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function onParserExecute(server, socket, parser, state, ret) {
                      Severity: Minor
                      Found in lts/lib/_http_server.js - About 35 mins to fix

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

                        function socketOnEnd(server, socket, parser, state) {
                          const ret = parser.finish();
                        
                          if (ret instanceof Error) {
                            debug('parse error');
                        Severity: Minor
                        Found in lts/lib/_http_server.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

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

                        function clearIncoming(req) {
                          req = req || this;
                          const parser = req.socket && req.socket.parser;
                          // Reset the .incoming property so that the request object can be gc'ed.
                          if (parser && parser.incoming === req) {
                        Severity: Minor
                        Found in lts/lib/_http_server.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

                        Function socketOnError has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function socketOnError(e) {
                          // Ignore further errors
                          this.removeListener('error', socketOnError);
                          this.on('error', noop);
                        
                        
                        Severity: Minor
                        Found in lts/lib/_http_server.js - About 25 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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function writeHead(statusCode, reason, obj) {
                          const originalStatusCode = statusCode;
                        
                          statusCode |= 0;
                          if (statusCode < 100 || statusCode > 999) {
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 2 days to fix
                        current/lib/_http_server.js on lines 244..316

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 448.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        const STATUS_CODES = {
                          100: 'Continue',
                          101: 'Switching Protocols',
                          102: 'Processing',                 // RFC 2518, obsoleted by RFC 4918
                          103: 'Early Hints',
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 2 days to fix
                        current/lib/_http_server.js on lines 80..144

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 357.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function resOnFinish(req, res, socket, state, server) {
                          // Usually the first incoming element should be our request.  it may
                          // be that in the case abortIncoming() was called that the incoming
                          // array will be empty.
                          assert(state.incoming.length === 0 || state.incoming[0] === req);
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 day to fix
                        current/lib/_http_server.js on lines 674..710

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 303.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                          if (req.headers.expect !== undefined &&
                              (req.httpVersionMajor === 1 && req.httpVersionMinor === 1)) {
                            if (continueExpression.test(req.headers.expect)) {
                              res._expect_continue = true;
                        
                        
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 day to fix
                        current/lib/_http_server.js on lines 764..783

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 211.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function socketOnEnd(server, socket, parser, state) {
                          const ret = parser.finish();
                        
                          if (ret instanceof Error) {
                            debug('parse error');
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 day to fix
                        current/lib/_http_server.js on lines 541..560

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 195.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function ServerResponse(req) {
                          OutgoingMessage.call(this);
                        
                          if (req.method === 'HEAD') this._hasBody = false;
                        
                        
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 7 hrs to fix
                        current/lib/_http_server.js on lines 156..176

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 187.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function generateSocketListenerWrapper(originalFnName) {
                          return function socketListenerWrap(ev, fn) {
                            const res = net.Socket.prototype[originalFnName].call(this, ev, fn);
                            if (!this.parser) {
                              this.on = net.Socket.prototype.on;
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 6 hrs to fix
                        current/lib/_http_server.js on lines 830..845

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 166.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function socketOnDrain(socket, state) {
                          const needPause = state.outgoingData > socket.writableHighWaterMark;
                        
                          // If we previously paused, then start reading again.
                          if (socket._paused && !needPause) {
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 5 hrs to fix
                        current/lib/_http_server.js on lines 492..508

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 151.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function socketOnTimeout() {
                          const req = this.parser && this.parser.incoming;
                          const reqTimeout = req && !req.complete && req.emit('timeout', this);
                          const res = this._httpMessage;
                          const resTimeout = res && res.emit('timeout', this);
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 5 hrs to fix
                        current/lib/_http_server.js on lines 510..519

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 140.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function clearIncoming(req) {
                          req = req || this;
                          const parser = req.socket && req.socket.parser;
                          // Reset the .incoming property so that the request object can be gc'ed.
                          if (parser && parser.incoming === req) {
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 4 hrs to fix
                        current/lib/_http_server.js on lines 658..672

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 130.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                            case 'request':
                              const [ , res] = args;
                              if (!res.headersSent && !res.writableEnded) {
                                // Don't leak headers.
                                for (const name of res.getHeaderNames()) {
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 3 hrs to fix
                        current/lib/_http_server.js on lines 377..389

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 110.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                            if (eventName === 'upgrade' || server.listenerCount(eventName) > 0) {
                              debug('SERVER have listener for %s', eventName);
                              const bodyHead = d.slice(ret, d.length);
                        
                              socket.readableFlowing = null;
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 3 hrs to fix
                        current/lib/_http_server.js on lines 639..648

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 96.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function onSocketResume() {
                          // It may seem that the socket is resumed, but this is an enemy's trick to
                          // deceive us! `resume` is emitted asynchronously, and may be called from
                          // `incoming.readStart()`. Stop the socket again here, just to preserve the
                          // state.
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 2 hrs to fix
                        current/lib/_http_server.js on lines 795..811

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 91.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                          if (!socket._paused) {
                            const ws = socket._writableState;
                            if (ws.needDrain || state.outgoingData >= socket.writableHighWaterMark) {
                              socket._paused = true;
                              // We also need to pause the parser, but don't do that until after
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 2 hrs to fix
                        current/lib/_http_server.js on lines 734..743

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 84.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                          if (socket._handle && socket._handle.isStreamBase &&
                              !socket._handle._consumed) {
                            parser._consumed = true;
                            socket._handle._consumed = true;
                            parser.consume(socket._handle);
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 2 hrs to fix
                        current/lib/_http_server.js on lines 472..477

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 80.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                        ServerResponse.prototype._finish = function _finish() {
                          DTRACE_HTTP_SERVER_RESPONSE(this.connection);
                          if (this[kServerResponseStatistics] !== undefined) {
                            emitStatistics(this[kServerResponseStatistics]);
                          }
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 2 hrs to fix
                        current/lib/_http_server.js on lines 180..186

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 78.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                          if (typeof options === 'function') {
                            requestListener = options;
                            options = {};
                          } else if (options == null || typeof options === 'object') {
                            options = { ...options };
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 324..331

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 74.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function unconsume(parser, socket) {
                          if (socket._handle) {
                            if (parser._consumed)
                              parser.unconsume();
                            parser._consumed = false;
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 820..828

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 74.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function abortIncoming(incoming) {
                          while (incoming.length) {
                            const req = incoming.shift();
                            req.aborted = true;
                            req.emit('aborted');
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 531..539

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 69.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function socketOnData(server, socket, parser, state, d) {
                          assert(!socket._paused);
                          debug('SERVER socketOnData %d', d.length);
                        
                          const ret = parser.execute(d);
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 562..568

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 65.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        ServerResponse.prototype.writeContinue = function writeContinue(cb) {
                          this._writeRaw(`HTTP/1.1 100 Continue${CRLF}${CRLF}`, 'ascii', cb);
                          this._sent100 = true;
                        };
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 230..233

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 60.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function onSocketPause() {
                          if (this._handle && this._handle.reading) {
                            this._handle.reading = false;
                            this._handle.readStop();
                          }
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 813..818

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 60.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                          if (req.upgrade) {
                            req.upgrade = req.method === 'CONNECT' ||
                                          server.listenerCount('upgrade') > 0;
                            if (req.upgrade)
                              return 2;
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 722..727

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 57.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function socketOnClose(socket, state) {
                          debug('server socket close');
                          // Mark this parser as reusable
                          if (socket.parser) {
                            freeParser(socket.parser, null, socket);
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 521..529

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 56.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                          const state = {
                            onData: null,
                            onEnd: null,
                            onClose: null,
                            onDrain: null,
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 437..450

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                          if (ret instanceof Error) {
                            prepareError(ret, parser, d);
                            ret.rawPacket = d || parser.getCurrentBuffer();
                            debug('parse error', ret);
                            socketOnError.call(socket, ret);
                        Severity: Major
                        Found in lts/lib/_http_server.js and 1 other location - About 1 hr to fix
                        current/lib/_http_server.js on lines 614..649

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 55.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        Server.prototype.setTimeout = function setTimeout(msecs, callback) {
                          this.timeout = msecs;
                          if (callback)
                            this.on('timeout', callback);
                          return this;
                        Severity: Minor
                        Found in lts/lib/_http_server.js and 1 other location - About 55 mins to fix
                        current/lib/_http_server.js on lines 368..373

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 54.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function resetSocketTimeout(server, socket, state) {
                          if (!state.keepAliveTimeoutSet)
                            return;
                        
                          socket.setTimeout(server.timeout || 0);
                        Severity: Minor
                        Found in lts/lib/_http_server.js and 1 other location - About 50 mins to fix
                        current/lib/_http_server.js on lines 787..793

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 52.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        function onServerResponseClose() {
                          // EventEmitter.emit makes a copy of the 'close' listeners array before
                          // calling the listeners. detachSocket() unregisters onServerResponseClose
                          // but if detachSocket() is called, directly or indirectly, by a 'close'
                          // listener, onServerResponseClose is still in that copy of the listeners
                        Severity: Minor
                        Found in lts/lib/_http_server.js and 1 other location - About 45 mins to fix
                        current/lib/_http_server.js on lines 192..212

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 50.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 4 locations. Consider refactoring.
                        Open

                        const badRequestResponse = Buffer.from(
                          `HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}` +
                          `Connection: close${CRLF}${CRLF}`, 'ascii'
                        );
                        Severity: Major
                        Found in lts/lib/_http_server.js and 3 other locations - About 45 mins to fix
                        current/lib/_http_server.js on lines 588..591
                        current/lib/_http_server.js on lines 592..595
                        lts/lib/_http_server.js on lines 595..598

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 50.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 4 locations. Consider refactoring.
                        Open

                        const requestHeaderFieldsTooLargeResponse = Buffer.from(
                          `HTTP/1.1 431 ${STATUS_CODES[431]}${CRLF}` +
                          `Connection: close${CRLF}${CRLF}`, 'ascii'
                        );
                        Severity: Major
                        Found in lts/lib/_http_server.js and 3 other locations - About 45 mins to fix
                        current/lib/_http_server.js on lines 588..591
                        current/lib/_http_server.js on lines 592..595
                        lts/lib/_http_server.js on lines 591..594

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 50.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                        ServerResponse.prototype.writeProcessing = function writeProcessing(cb) {
                          this._writeRaw(`HTTP/1.1 102 Processing${CRLF}${CRLF}`, 'ascii', cb);
                        };
                        Severity: Minor
                        Found in lts/lib/_http_server.js and 1 other location - About 40 mins to fix
                        current/lib/_http_server.js on lines 235..237

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 49.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                          if (socket._httpMessage) {
                            // There are already pending outgoing res, append.
                            state.outgoing.push(res);
                          } else {
                            res.assignSocket(socket);
                        Severity: Minor
                        Found in lts/lib/_http_server.js and 1 other location - About 35 mins to fix
                        current/lib/_http_server.js on lines 752..757

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 46.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        There are no issues that match your filters.

                        Category
                        Status