enclose-io/compiler

View on GitHub
lts/lib/internal/http2/core.js

Summary

Maintainability
F
3 mos
Test Coverage

File core.js has 2277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/* eslint-disable no-use-before-define */

const {
Severity: Major
Found in lts/lib/internal/http2/core.js - About 6 days to fix

    Function onSessionHeaders has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    function onSessionHeaders(handle, id, cat, flags, headers) {
      const session = this[kOwner];
      if (session.destroyed)
        return;
    
    
    Severity: Minor
    Found in lts/lib/internal/http2/core.js - About 4 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 request has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

      request(headers, options) {
        debugSessionObj(this, 'initiating request');
    
        if (this.destroyed)
          throw new ERR_HTTP2_INVALID_SESSION();
    Severity: Minor
    Found in lts/lib/internal/http2/core.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

    Http2Stream has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Http2Stream extends Duplex {
      constructor(session, options) {
        options.allowHalfOpen = true;
        options.decodeStrings = false;
        super(options);
    Severity: Minor
    Found in lts/lib/internal/http2/core.js - About 3 hrs to fix

      Http2Session has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Http2Session extends EventEmitter {
        constructor(type, options, socket) {
          super();
      
          if (!socket._handle || !socket._handle.isStreamBase) {
      Severity: Minor
      Found in lts/lib/internal/http2/core.js - About 3 hrs to fix

        Function doSendFileFD has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
          const onError = options.onError;
        
          if (err) {
            tryClose(fd);
        Severity: Minor
        Found in lts/lib/internal/http2/core.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 altsvc has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          altsvc(alt, originOrStream) {
            if (this.destroyed)
              throw new ERR_HTTP2_INVALID_SESSION();
        
            let stream = 0;
        Severity: Minor
        Found in lts/lib/internal/http2/core.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 onSessionHeaders has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function onSessionHeaders(handle, id, cat, flags, headers) {
          const session = this[kOwner];
          if (session.destroyed)
            return;
        
        
        Severity: Major
        Found in lts/lib/internal/http2/core.js - About 2 hrs to fix

          Function request has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            request(headers, options) {
              debugSessionObj(this, 'initiating request');
          
              if (this.destroyed)
                throw new ERR_HTTP2_INVALID_SESSION();
          Severity: Major
          Found in lts/lib/internal/http2/core.js - About 2 hrs to fix

            Function pushStream has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              pushStream(headers, options, callback) {
                if (!this.pushAllowed)
                  throw new ERR_HTTP2_PUSH_DISABLED();
                if (this[kID] % 2 === 0)
                  throw new ERR_HTTP2_NESTED_PUSH();
            Severity: Major
            Found in lts/lib/internal/http2/core.js - About 2 hrs to fix

              Function doSendFileFD has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
                const onError = options.onError;
              
                if (err) {
                  tryClose(fd);
              Severity: Major
              Found in lts/lib/internal/http2/core.js - About 2 hrs to fix

                Function constructor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  constructor(type, options, socket) {
                    super();
                
                    if (!socket._handle || !socket._handle.isStreamBase) {
                      socket = new JSStreamSocket(socket);
                Severity: Minor
                Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                  Function pushStream has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    pushStream(headers, options, callback) {
                      if (!this.pushAllowed)
                        throw new ERR_HTTP2_PUSH_DISABLED();
                      if (this[kID] % 2 === 0)
                        throw new ERR_HTTP2_NESTED_PUSH();
                  Severity: Minor
                  Found in lts/lib/internal/http2/core.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 connect has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function connect(authority, options, listener) {
                    if (typeof options === 'function') {
                      listener = options;
                      options = undefined;
                    }
                  Severity: Minor
                  Found in lts/lib/internal/http2/core.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 setupHandle has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function setupHandle(socket, type, options) {
                    // If the session has been destroyed, go ahead and emit 'connect',
                    // but do nothing else. The various on('connect') handlers set by
                    // core will check for session.destroyed before progressing, this
                    // ensures that those at l`east get cleared out.
                  Severity: Minor
                  Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                    Function respondWithFD has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      respondWithFD(fd, headers, options) {
                        if (this.destroyed || this.closed)
                          throw new ERR_HTTP2_INVALID_STREAM();
                        if (this.headersSent)
                          throw new ERR_HTTP2_HEADERS_SENT();
                    Severity: Minor
                    Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                      Function connect has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function connect(authority, options, listener) {
                        if (typeof options === 'function') {
                          listener = options;
                          options = undefined;
                        }
                      Severity: Minor
                      Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                        Function getUnpackedSettings has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function getUnpackedSettings(buf, options = {}) {
                          if (!isArrayBufferView(buf)) {
                            throw new ERR_INVALID_ARG_TYPE('buf',
                                                           ['Buffer', 'TypedArray', 'DataView'], buf);
                          }
                        Severity: Minor
                        Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                          Function requestOnConnect has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function requestOnConnect(headers, options) {
                            const session = this[kSession];
                          
                            // At this point, the stream should have already been destroyed during
                            // the session.destroy() method. Do nothing else.
                          Severity: Minor
                          Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                            Function respondWithFD has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                              respondWithFD(fd, headers, options) {
                                if (this.destroyed || this.closed)
                                  throw new ERR_HTTP2_INVALID_STREAM();
                                if (this.headersSent)
                                  throw new ERR_HTTP2_HEADERS_SENT();
                            Severity: Minor
                            Found in lts/lib/internal/http2/core.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 respond has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              respond(headers, options) {
                                if (this.destroyed || this.closed)
                                  throw new ERR_HTTP2_INVALID_STREAM();
                                if (this.headersSent)
                                  throw new ERR_HTTP2_HEADERS_SENT();
                            Severity: Minor
                            Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                              Function respondWithFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                respondWithFile(path, headers, options) {
                                  if (this.destroyed || this.closed)
                                    throw new ERR_HTTP2_INVALID_STREAM();
                                  if (this.headersSent)
                                    throw new ERR_HTTP2_HEADERS_SENT();
                              Severity: Minor
                              Found in lts/lib/internal/http2/core.js - About 1 hr to fix

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

                                  altsvc(alt, originOrStream) {
                                    if (this.destroyed)
                                      throw new ERR_HTTP2_INVALID_SESSION();
                                
                                    let stream = 0;
                                Severity: Minor
                                Found in lts/lib/internal/http2/core.js - About 1 hr to fix

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

                                  function connectionListener(socket) {
                                    debug('Http2Session server: received a connection');
                                    const options = this[kOptions] || {};
                                  
                                    if (socket.alpnProtocol === false || socket.alpnProtocol === 'http/1.1') {
                                  Severity: Minor
                                  Found in lts/lib/internal/http2/core.js - About 1 hr to fix

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

                                      _destroy(err, callback) {
                                        const session = this[kSession];
                                        const handle = this[kHandle];
                                        const id = this[kID];
                                    
                                    
                                    Severity: Minor
                                    Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                                      Function origin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        origin(...origins) {
                                          if (this.destroyed)
                                            throw new ERR_HTTP2_INVALID_SESSION();
                                      
                                          if (origins.length === 0)
                                      Severity: Minor
                                      Found in lts/lib/internal/http2/core.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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        constructor(type, options, socket) {
                                          super();
                                      
                                          if (!socket._handle || !socket._handle.isStreamBase) {
                                            socket = new JSStreamSocket(socket);
                                      Severity: Minor
                                      Found in lts/lib/internal/http2/core.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 _destroy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        _destroy(err, callback) {
                                          const session = this[kSession];
                                          const handle = this[kHandle];
                                          const id = this[kID];
                                      
                                      
                                      Severity: Minor
                                      Found in lts/lib/internal/http2/core.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 destroy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        destroy(error = NGHTTP2_NO_ERROR, code) {
                                          if (this.destroyed)
                                            return;
                                          debugSessionObj(this, 'destroying');
                                      
                                      
                                      Severity: Minor
                                      Found in lts/lib/internal/http2/core.js - About 1 hr to fix

                                        Function validateSettings has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        const validateSettings = hideStackFrames((settings) => {
                                          if (settings === undefined) return;
                                          assertWithinRange('headerTableSize',
                                                            settings.headerTableSize,
                                                            0, kMaxInt);
                                        Severity: Minor
                                        Found in lts/lib/internal/http2/core.js - About 1 hr to fix

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

                                            respondWithFile(path, headers, options) {
                                              if (this.destroyed || this.closed)
                                                throw new ERR_HTTP2_INVALID_STREAM();
                                              if (this.headersSent)
                                                throw new ERR_HTTP2_HEADERS_SENT();
                                          Severity: Minor
                                          Found in lts/lib/internal/http2/core.js - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

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

                                            additionalHeaders(headers) {
                                              if (this.destroyed || this.closed)
                                                throw new ERR_HTTP2_INVALID_STREAM();
                                              if (this.headersSent)
                                                throw new ERR_HTTP2_HEADERS_AFTER_RESPOND();
                                          Severity: Minor
                                          Found in lts/lib/internal/http2/core.js - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

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

                                          function setupHandle(socket, type, options) {
                                            // If the session has been destroyed, go ahead and emit 'connect',
                                            // but do nothing else. The various on('connect') handlers set by
                                            // core will check for session.destroyed before progressing, this
                                            // ensures that those at l`east get cleared out.
                                          Severity: Minor
                                          Found in lts/lib/internal/http2/core.js - About 55 mins to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Function doSendFD has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                          function doSendFD(session, options, fd, headers, streamOptions, err, stat) {
                                          Severity: Major
                                          Found in lts/lib/internal/http2/core.js - About 50 mins to fix

                                            Function doSendFileFD has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                            function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
                                            Severity: Major
                                            Found in lts/lib/internal/http2/core.js - About 50 mins to fix

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

                                              function processRespondWithFD(self, fd, headers, offset = 0, length = -1,
                                                                            streamOptions = 0) {
                                              Severity: Minor
                                              Found in lts/lib/internal/http2/core.js - About 45 mins to fix

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

                                                function afterOpen(session, options, headers, streamOptions, err, fd) {
                                                Severity: Minor
                                                Found in lts/lib/internal/http2/core.js - About 45 mins to fix

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

                                                  function onStreamClose(code) {
                                                    const stream = this[kOwner];
                                                    if (!stream || stream.destroyed)
                                                      return false;
                                                  
                                                  
                                                  Severity: Minor
                                                  Found in lts/lib/internal/http2/core.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 setAndValidatePriorityOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  const setAndValidatePriorityOptions = hideStackFrames((options) => {
                                                    if (options.weight === undefined) {
                                                      options.weight = NGHTTP2_DEFAULT_WEIGHT;
                                                    } else if (typeof options.weight !== 'number') {
                                                      throw new ERR_INVALID_OPT_VALUE('weight', options.weight);
                                                  Severity: Minor
                                                  Found in lts/lib/internal/http2/core.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 processHeaders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  function processHeaders(oldHeaders) {
                                                    assertIsObject(oldHeaders, 'headers');
                                                    const headers = ObjectCreate(null);
                                                  
                                                    if (oldHeaders !== null && oldHeaders !== undefined) {
                                                  Severity: Minor
                                                  Found in lts/lib/internal/http2/core.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 callTimeout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  function callTimeout(self, kSession) {
                                                    // If the session is destroyed, this should never actually be invoked,
                                                    // but just in case...
                                                    if (self.destroyed)
                                                      return;
                                                  Severity: Minor
                                                  Found in lts/lib/internal/http2/core.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 ping has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                    ping(payload, callback) {
                                                      if (this.destroyed)
                                                        throw new ERR_HTTP2_INVALID_SESSION();
                                                  
                                                      if (typeof payload === 'function') {
                                                  Severity: Minor
                                                  Found in lts/lib/internal/http2/core.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 doSendFD has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  function doSendFD(session, options, fd, headers, streamOptions, err, stat) {
                                                    if (err) {
                                                      this.destroy(err);
                                                      return;
                                                    }
                                                  Severity: Minor
                                                  Found in lts/lib/internal/http2/core.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

                                                  Consider simplifying this complex logical expression.
                                                  Open

                                                        if (this.headersSent &&
                                                            this[kSession] &&
                                                            this[kSession][kType] === NGHTTP2_SESSION_SERVER &&
                                                            !(state.flags & STREAM_FLAGS_HAS_TRAILERS) &&
                                                            !state.didRead &&
                                                  Severity: Major
                                                  Found in lts/lib/internal/http2/core.js - About 40 mins to fix

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

                                                    function onSessionHeaders(handle, id, cat, flags, headers) {
                                                    Severity: Minor
                                                    Found in lts/lib/internal/http2/core.js - About 35 mins to fix

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

                                                        respond(headers, options) {
                                                          if (this.destroyed || this.closed)
                                                            throw new ERR_HTTP2_INVALID_STREAM();
                                                          if (this.headersSent)
                                                            throw new ERR_HTTP2_HEADERS_SENT();
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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 destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                        destroy(error = NGHTTP2_NO_ERROR, code) {
                                                          if (this.destroyed)
                                                            return;
                                                          debugSessionObj(this, 'destroying');
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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 sessionListenerRemoved has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function sessionListenerRemoved(name) {
                                                        switch (name) {
                                                          case 'ping':
                                                            if (this.listenerCount(name) > 0) return;
                                                            this[kNativeFields][kBitfield] &= ~(1 << kSessionHasPingListeners);
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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 kMaybeDestroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                        [kMaybeDestroy](code = NGHTTP2_NO_ERROR) {
                                                          if (code !== NGHTTP2_NO_ERROR) {
                                                            this.destroy();
                                                            return;
                                                          }
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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 requestOnConnect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function requestOnConnect(headers, options) {
                                                        const session = this[kSession];
                                                      
                                                        // At this point, the stream should have already been destroyed during
                                                        // the session.destroy() method. Do nothing else.
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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 closeStream has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function closeStream(stream, code, rstStreamStatus = kSubmitRstStream) {
                                                        const state = stream[kState];
                                                        state.flags |= STREAM_FLAGS_CLOSED;
                                                        state.rstCode = code;
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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 getUnpackedSettings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function getUnpackedSettings(buf, options = {}) {
                                                        if (!isArrayBufferView(buf)) {
                                                          throw new ERR_INVALID_ARG_TYPE('buf',
                                                                                         ['Buffer', 'TypedArray', 'DataView'], buf);
                                                        }
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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 initOriginSet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function initOriginSet(session) {
                                                        let originSet = session[kState].originSet;
                                                        if (originSet === undefined) {
                                                          const socket = session[kSocket];
                                                          session[kState].originSet = originSet = new Set();
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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

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

                                                      function settingsCallback(cb, ack, duration) {
                                                        this[kState].pendingAck--;
                                                        this[kLocalSettings] = undefined;
                                                        if (ack) {
                                                          debugSessionObj(this, 'settings received');
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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

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

                                                      function connectionListener(socket) {
                                                        debug('Http2Session server: received a connection');
                                                        const options = this[kOptions] || {};
                                                      
                                                        if (socket.alpnProtocol === false || socket.alpnProtocol === 'http/1.1') {
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.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

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

                                                      class ServerHttp2Stream extends Http2Stream {
                                                        constructor(session, handle, id, options, headers) {
                                                          super(session, options);
                                                          handle.owner = this;
                                                          this[kInit](id, handle);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 wk to fix
                                                      current/lib/internal/http2/core.js on lines 2420..2722

                                                      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 2162.

                                                      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

                                                      class ServerHttp2Session extends Http2Session {
                                                        constructor(options, socket, server) {
                                                          super(NGHTTP2_SESSION_SERVER, options, socket);
                                                          this[kServer] = server;
                                                          // This is a bit inaccurate because it does not reflect changes to
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 days to fix
                                                      current/lib/internal/http2/core.js on lines 1484..1582

                                                      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 693.

                                                      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

                                                      class ClientHttp2Session extends Http2Session {
                                                        constructor(options, socket) {
                                                          super(NGHTTP2_SESSION_CLIENT, options, socket);
                                                          this[kPendingRequestCalls] = null;
                                                        }
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 days to fix
                                                      current/lib/internal/http2/core.js on lines 1588..1675

                                                      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 689.

                                                      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

                                                      function onSessionHeaders(handle, id, cat, flags, headers) {
                                                        const session = this[kOwner];
                                                        if (session.destroyed)
                                                          return;
                                                      
                                                      
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 days to fix
                                                      current/lib/internal/http2/core.js on lines 299..372

                                                      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 586.

                                                      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

                                                      function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
                                                        const onError = options.onError;
                                                      
                                                        if (err) {
                                                          tryClose(fd);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 days to fix
                                                      current/lib/internal/http2/core.js on lines 2330..2397

                                                      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 516.

                                                      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 setupHandle(socket, type, options) {
                                                        // If the session has been destroyed, go ahead and emit 'connect',
                                                        // but do nothing else. The various on('connect') handlers set by
                                                        // core will check for session.destroyed before progressing, this
                                                        // ensures that those at l`east get cleared out.
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 days to fix
                                                      current/lib/internal/http2/core.js on lines 927..992

                                                      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 488.

                                                      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

                                                        constructor(type, options, socket) {
                                                          super();
                                                      
                                                          if (!socket._handle || !socket._handle.isStreamBase) {
                                                            socket = new JSStreamSocket(socket);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 days to fix
                                                      current/lib/internal/http2/core.js on lines 1110..1177

                                                      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 468.

                                                      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

                                                      function connect(authority, options, listener) {
                                                        if (typeof options === 'function') {
                                                          listener = options;
                                                          options = undefined;
                                                        }
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 days to fix
                                                      current/lib/internal/http2/core.js on lines 2987..3042

                                                      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 461.

                                                      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

                                                        _destroy(err, callback) {
                                                          const session = this[kSession];
                                                          const handle = this[kHandle];
                                                          const id = this[kID];
                                                      
                                                      
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 days to fix
                                                      current/lib/internal/http2/core.js on lines 2090..2135

                                                      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 379.

                                                      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 connectionListener(socket) {
                                                        debug('Http2Session server: received a connection');
                                                        const options = this[kOptions] || {};
                                                      
                                                        if (socket.alpnProtocol === false || socket.alpnProtocol === 'http/1.1') {
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 2793..2838

                                                      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 341.

                                                      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 proxySocketHandler = {
                                                        get(session, prop) {
                                                          switch (prop) {
                                                            case 'setTimeout':
                                                            case 'ref':
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 809..867

                                                      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 332.

                                                      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 requestOnConnect(headers, options) {
                                                        const session = this[kSession];
                                                      
                                                        // At this point, the stream should have already been destroyed during
                                                        // the session.destroy() method. Do nothing else.
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 649..708

                                                      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 324.

                                                      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 getUnpackedSettings(buf, options = {}) {
                                                        if (!isArrayBufferView(buf)) {
                                                          throw new ERR_INVALID_ARG_TYPE('buf',
                                                                                         ['Buffer', 'TypedArray', 'DataView'], buf);
                                                        }
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 3075..3117

                                                      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 286.

                                                      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 setAndValidatePriorityOptions = hideStackFrames((options) => {
                                                        if (options.weight === undefined) {
                                                          options.weight = NGHTTP2_DEFAULT_WEIGHT;
                                                        } else if (typeof options.weight !== 'number') {
                                                          throw new ERR_INVALID_OPT_VALUE('weight', options.weight);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 717..741

                                                      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 264.

                                                      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

                                                      Http2Server.prototype[EventEmitter.captureRejectionSymbol] = function(
                                                        err, event, ...args) {
                                                      
                                                        switch (event) {
                                                          case 'stream':
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 2929..2961

                                                      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 250.

                                                      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

                                                      function doSendFD(session, options, fd, headers, streamOptions, err, stat) {
                                                        if (err) {
                                                          this.destroy(err);
                                                          return;
                                                        }
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 2293..2328

                                                      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 231.

                                                      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 closeStream(stream, code, rstStreamStatus = kSubmitRstStream) {
                                                        const state = stream[kState];
                                                        state.flags |= STREAM_FLAGS_CLOSED;
                                                        state.rstCode = code;
                                                      
                                                      
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 1724..1755

                                                      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 228.

                                                      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 {
                                                        NGHTTP2_CANCEL,
                                                        NGHTTP2_REFUSED_STREAM,
                                                        NGHTTP2_DEFAULT_WEIGHT,
                                                        NGHTTP2_FLAG_END_STREAM,
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 228..274

                                                      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 208.

                                                      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 initializeOptions(options) {
                                                        assertIsObject(options, 'options');
                                                        options = { ...options };
                                                        assertIsObject(options.settings, 'options.settings');
                                                        options.settings = { ...options.settings };
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                      current/lib/internal/http2/core.js on lines 2840..2867

                                                      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 201.

                                                      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 processRespondWithFD(self, fd, headers, offset = 0, length = -1,
                                                                                    streamOptions = 0) {
                                                        const state = self[kState];
                                                        state.flags |= STREAM_FLAGS_HEADERS_SENT;
                                                      
                                                      
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2248..2276

                                                      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 194.

                                                      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 validateSettings = hideStackFrames((settings) => {
                                                        if (settings === undefined) return;
                                                        assertWithinRange('headerTableSize',
                                                                          settings.headerTableSize,
                                                                          0, kMaxInt);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 894..921

                                                      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 193.

                                                      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

                                                        ping(payload, callback) {
                                                          if (this.destroyed)
                                                            throw new ERR_HTTP2_INVALID_SESSION();
                                                      
                                                          if (typeof payload === 'function') {
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1241..1267

                                                      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 188.

                                                      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

                                                        [kMaybeDestroy](code = NGHTTP2_NO_ERROR) {
                                                          if (code !== NGHTTP2_NO_ERROR) {
                                                            this.destroy();
                                                            return;
                                                          }
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2138..2166

                                                      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 183.

                                                      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

                                                      function sessionListenerRemoved(name) {
                                                        switch (name) {
                                                          case 'ping':
                                                            if (this.listenerCount(name) > 0) return;
                                                            this[kNativeFields][kBitfield] &= ~(1 << kSessionHasPingListeners);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 424..446

                                                      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 181.

                                                      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

                                                        [kInit](id, handle) {
                                                          const state = this[kState];
                                                          state.flags |= STREAM_FLAGS_READY;
                                                      
                                                          const session = this[kSession];
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 6 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1821..1836

                                                      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 165.

                                                      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

                                                      function initOriginSet(session) {
                                                        let originSet = session[kState].originSet;
                                                        if (originSet === undefined) {
                                                          const socket = session[kSocket];
                                                          session[kState].originSet = originSet = new Set();
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 6 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 581..597

                                                      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 165.

                                                      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

                                                        _final(cb) {
                                                          const handle = this[kHandle];
                                                          if (this.pending) {
                                                            this.once('ready', () => this._final(cb));
                                                          } else if (handle !== undefined) {
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 6 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1978..1994

                                                      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 164.

                                                      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

                                                        [kWriteGeneric](writev, data, encoding, cb) {
                                                          // When the Http2Stream is first created, it is corked until the
                                                          // handle and the stream ID is assigned. However, if the user calls
                                                          // uncork() before that happens, the Duplex will attempt to pass
                                                          // writes through. Those need to be queued up here.
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 6 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1934..1968

                                                      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 159.

                                                      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 callTimeout(self, kSession) {
                                                        // If the session is destroyed, this should never actually be invoked,
                                                        // but just in case...
                                                        if (self.destroyed)
                                                          return;
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2169..2191

                                                      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 147.

                                                      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() {
                                                        const session = this[kSession];
                                                        if (session !== undefined) {
                                                          debugSessionObj(session, 'socket closed');
                                                          const err = session.connecting ? new ERR_SOCKET_CLOSED() : null;
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2974..2985

                                                      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 144.

                                                      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

                                                        sendTrailers(headers) {
                                                          if (this.destroyed || this.closed)
                                                            throw new ERR_HTTP2_INVALID_STREAM();
                                                          if (this[kSentTrailers])
                                                            throw new ERR_HTTP2_TRAILERS_ALREADY_SENT();
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2031..2051

                                                      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 143.

                                                      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

                                                        settings(settings, callback) {
                                                          if (this.destroyed)
                                                            throw new ERR_HTTP2_INVALID_SESSION();
                                                          assertIsObject(settings, 'settings');
                                                          validateSettings(settings);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1349..1367

                                                      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 139.

                                                      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

                                                        goaway(code = NGHTTP2_NO_ERROR, lastStreamID = 0, opaqueData) {
                                                          if (this.destroyed)
                                                            throw new ERR_HTTP2_INVALID_SESSION();
                                                      
                                                          if (opaqueData !== undefined && !isArrayBufferView(opaqueData)) {
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1373..1391

                                                      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 139.

                                                      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 onOrigin(origins) {
                                                        const session = this[kOwner];
                                                        if (session.destroyed)
                                                          return;
                                                        debugSessionObj(session, 'origin received: %j', origins);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 599..611

                                                      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 138.

                                                      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

                                                        close(code = NGHTTP2_NO_ERROR, callback) {
                                                          validateNumber(code, 'code');
                                                          if (code < 0 || code > kMaxInt)
                                                            throw new ERR_OUT_OF_RANGE('code', `>= 0 && <= ${kMaxInt}`, code);
                                                          if (callback !== undefined && typeof callback !== 'function')
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2070..2084

                                                      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 137.

                                                      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 onGoawayData(code, lastStreamID, buf) {
                                                        const session = this[kOwner];
                                                        if (session.destroyed)
                                                          return;
                                                        debugSessionObj(session, 'goaway %d received [last stream id: %d]',
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 619..644

                                                      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 132.

                                                      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 afterOpen(session, options, headers, streamOptions, err, fd) {
                                                        const state = this[kState];
                                                        const onError = options.onError;
                                                        if (err) {
                                                          if (onError)
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2399..2418

                                                      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

                                                      function settingsCallback(cb, ack, duration) {
                                                        this[kState].pendingAck--;
                                                        this[kLocalSettings] = undefined;
                                                        if (ack) {
                                                          debugSessionObj(this, 'settings received');
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 750..764

                                                      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 126.

                                                      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 sessionListenerAdded(name) {
                                                        switch (name) {
                                                          case 'ping':
                                                            this[kNativeFields][kBitfield] |= 1 << kSessionHasPingListeners;
                                                            break;
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 404..422

                                                      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 124.

                                                      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

                                                        get remoteSettings() {
                                                          if (this[kNativeFields][kBitfield] &
                                                              (1 << kSessionRemoteSettingsIsUpToDate)) {
                                                            const settings = this[kRemoteSettings];
                                                            if (settings !== undefined) {
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1332..1346

                                                      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 121.

                                                      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 onPriority(id, parent, weight, exclusive) {
                                                        const session = this[kOwner];
                                                        if (session.destroyed)
                                                          return;
                                                        debugStream(id, session[kType],
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 544..556

                                                      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 120.

                                                      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

                                                        _read(nread) {
                                                          if (this.destroyed) {
                                                            this.push(null);
                                                            return;
                                                          }
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1996..2010

                                                      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 119.

                                                      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

                                                        [kInspect](depth, opts) {
                                                          if (typeof depth === 'number' && depth < 0)
                                                            return this;
                                                      
                                                          const obj = {
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1838..1851

                                                      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 113.

                                                      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 (!stream.readable || code !== NGHTTP2_NO_ERROR) {
                                                          // If errored or ended, we can destroy immediately.
                                                          stream[kMaybeDestroy](code);
                                                        } else {
                                                          // Wait for end to destroy.
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 506..525

                                                      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 111.

                                                      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

                                                        [kInspect](depth, opts) {
                                                          if (typeof depth === 'number' && depth < 0)
                                                            return this;
                                                      
                                                          const obj = {
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1269..1282

                                                      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 111.

                                                      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 submitPriority(options) {
                                                        if (this.destroyed)
                                                          return;
                                                        this[kUpdateTimer]();
                                                      
                                                      
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 781..795

                                                      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

                                                        close(callback) {
                                                          if (this.closed || this.destroyed)
                                                            return;
                                                          debugSessionObj(this, 'marking session closed');
                                                          this[kState].flags |= SESSION_FLAGS_CLOSED;
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1426..1435

                                                      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 105.

                                                      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 socketOnError(error) {
                                                        const session = this[kSession];
                                                        if (session !== undefined) {
                                                          // We can ignore ECONNRESET after GOAWAY was received as there's nothing
                                                          // we can do and the other side is fully within its rights to do so.
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2753..2763

                                                      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 102.

                                                      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

                                                        priority(options) {
                                                          if (this.destroyed)
                                                            throw new ERR_HTTP2_INVALID_STREAM();
                                                      
                                                          assertIsObject(options, 'options');
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2012..2029

                                                      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 101.

                                                      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 startFilePipe(self, fd, offset, length) {
                                                        const handle = new FileHandle(fd, offset, length);
                                                        handle.onread = onPipedFileHandleRead;
                                                        handle.stream = self;
                                                      
                                                      
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2278..2291

                                                      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 100.

                                                      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 finishSendTrailers(stream, headersList) {
                                                        // The stream might be destroyed and in that case
                                                        // there is nothing to do.
                                                        // This can happen because finishSendTrailers is
                                                        // scheduled via setImmediate.
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1702..1718

                                                      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 97.

                                                      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 onFrameError(id, type, code) {
                                                        const session = this[kOwner];
                                                        if (session.destroyed)
                                                          return;
                                                        debugSessionObj(session, 'error sending frame type %d on stream %d, code: %d',
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 560..569

                                                      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

                                                        [kMaybeDestroy](error) {
                                                          if (error == null) {
                                                            const state = this[kState];
                                                            // Do not destroy if we're not closed and there are pending/open streams
                                                            if (!this.closed ||
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1451..1462

                                                      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 initializeTLSOptions(options, servername) {
                                                        options = initializeOptions(options);
                                                        options.ALPNProtocols = ['h2'];
                                                        if (options.allowHTTP1 === true)
                                                          options.ALPNProtocols.push('http/1.1');
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2869..2877

                                                      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 95.

                                                      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 submitSettings(settings, callback) {
                                                        if (this.destroyed)
                                                          return;
                                                        debugSessionObj(this, 'submitting settings');
                                                        this[kUpdateTimer]();
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 767..776

                                                      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 94.

                                                      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 onStreamTrailers() {
                                                        const stream = this[kOwner];
                                                        stream[kState].trailersReady = true;
                                                        if (stream.destroyed || stream.closed)
                                                          return;
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 383..392

                                                      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 89.

                                                      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

                                                        setNextStreamID(id) {
                                                          if (this.destroyed)
                                                            throw new ERR_HTTP2_INVALID_SESSION();
                                                      
                                                          validateNumber(id, 'id');
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1228..1236

                                                      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 88.

                                                      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 onFileUnpipe() {
                                                        const stream = this.sink[kOwner];
                                                        if (stream.ownsFd)
                                                          this.source.close().catch(stream.destroy.bind(stream));
                                                        else
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2231..2237

                                                      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 83.

                                                      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 onSettings() {
                                                        const session = this[kOwner];
                                                        if (session.destroyed)
                                                          return;
                                                        session[kUpdateTimer]();
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                      current/lib/internal/http2/core.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 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 3 locations. Consider refactoring.
                                                      Open

                                                      const {
                                                        paddingBuffer,
                                                        PADDING_BUF_FRAME_LENGTH,
                                                        PADDING_BUF_MAX_PAYLOAD_LENGTH,
                                                        PADDING_BUF_RETURN_VALUE,
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 2 other locations - About 2 hrs to fix
                                                      current/lib/v8.js on lines 17..32
                                                      lts/lib/v8.js on lines 17..32

                                                      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

                                                        get localSettings() {
                                                          const settings = this[kLocalSettings];
                                                          if (settings !== undefined)
                                                            return settings;
                                                      
                                                      
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1320..1329

                                                      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 77.

                                                      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 finishCloseStream(code) {
                                                        const rstStreamFn = submitRstStream.bind(this, code);
                                                        // If the handle has not yet been assigned, queue up the request to
                                                        // ensure that the RST_STREAM frame is sent after the stream ID has
                                                        // been determined.
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 1757..1768

                                                      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 77.

                                                      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

                                                      class ClientHttp2Stream extends Http2Stream {
                                                        constructor(session, handle, id, options) {
                                                          super(session, options);
                                                          this[kState].flags |= STREAM_FLAGS_HEADERS_SENT;
                                                          if (id !== undefined)
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                      current/lib/internal/http2/core.js on lines 2726..2734

                                                      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 75.

                                                      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

                                                      module.exports = {
                                                        connect,
                                                        constants,
                                                        createServer,
                                                        createSecureServer,
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 3134..3146

                                                      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 71.

                                                      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 streamListenerAdded(name) {
                                                        const session = this[kSession];
                                                        if (!session) return;
                                                        switch (name) {
                                                          case 'priority':
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 450..461

                                                      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 70.

                                                      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 setupCompat(ev) {
                                                        if (ev === 'request') {
                                                          this.removeListener('newListener', setupCompat);
                                                          this.on('stream', onServerStream.bind(
                                                            this,
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 2963..2972

                                                      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 70.

                                                      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 {
                                                        ArrayFrom,
                                                        ArrayIsArray,
                                                        Map,
                                                        MathMin,
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 5..18

                                                      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 70.

                                                      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 pingCallback(cb) {
                                                        return function pingCallback(ack, duration, payload) {
                                                          if (ack) {
                                                            cb(null, duration, payload);
                                                          } else {
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 875..883

                                                      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 sessionOnTimeout() {
                                                        // If destroyed or closed already, do nothing
                                                        if (this.destroyed || this.closed)
                                                          return;
                                                        const server = this[kServer];
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 2784..2791

                                                      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 68.

                                                      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 streamListenerRemoved(name) {
                                                        const session = this[kSession];
                                                        if (!session) return;
                                                        switch (name) {
                                                          case 'priority':
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 463..474

                                                      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 67.

                                                      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 onPing(payload) {
                                                        const session = this[kOwner];
                                                        if (session.destroyed)
                                                          return;
                                                        session[kUpdateTimer]();
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 476..483

                                                      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 66.

                                                      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 onAltSvc(stream, origin, alt) {
                                                        const session = this[kOwner];
                                                        if (session.destroyed)
                                                          return;
                                                        debugSessionObj(session, 'altsvc received: stream: %d, origin: %s, alt: %s',
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 571..579

                                                      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 66.

                                                      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 trackWriteState(stream, bytes) {
                                                        const session = stream[kSession];
                                                        stream[kState].writeQueueSize += bytes;
                                                        session[kState].writeQueueSize += bytes;
                                                        session[kHandle].chunksSentSinceLastWrite = 0;
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 1677..1682

                                                      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 66.

                                                      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 4 locations. Consider refactoring.
                                                      Open

                                                        setTimeout(msecs, callback) {
                                                          this.timeout = msecs;
                                                          if (callback !== undefined) {
                                                            if (typeof callback !== 'function')
                                                              throw new ERR_INVALID_CALLBACK(callback);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 3 other locations - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 2896..2904
                                                      current/lib/internal/http2/core.js on lines 2918..2926
                                                      lts/lib/internal/http2/core.js on lines 2901..2909

                                                      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 64.

                                                      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 4 locations. Consider refactoring.
                                                      Open

                                                        setTimeout(msecs, callback) {
                                                          this.timeout = msecs;
                                                          if (callback !== undefined) {
                                                            if (typeof callback !== 'function')
                                                              throw new ERR_INVALID_CALLBACK(callback);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 3 other locations - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 2896..2904
                                                      current/lib/internal/http2/core.js on lines 2918..2926
                                                      lts/lib/internal/http2/core.js on lines 2879..2887

                                                      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 64.

                                                      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

                                                        [EventEmitter.captureRejectionSymbol](err, event, ...args) {
                                                          switch (event) {
                                                            case 'stream':
                                                              const [stream] = args;
                                                              stream.destroy(err);
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 1437..1446

                                                      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 63.

                                                      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

                                                        [kUpdateTimer]() {
                                                          if (this.destroyed)
                                                            return;
                                                          if (this[kTimeout])
                                                            this[kTimeout].refresh();
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 1812..1819

                                                      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 61.

                                                      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 (oldHeaders !== null && oldHeaders !== undefined) {
                                                          // This loop is here for performance reason. Do not change.
                                                          for (const key in oldHeaders) {
                                                            if (ObjectPrototypeHasOwnProperty(oldHeaders, key)) {
                                                              headers[key] = oldHeaders[key];
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 2201..2208

                                                      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 61.

                                                      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

                                                      ObjectDefineProperty(connect, promisify.custom, {
                                                        value: (authority, options) => {
                                                          return new Promise((resolve) => {
                                                            const server = connect(authority, options, () => resolve(server));
                                                          });
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 3045..3051

                                                      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 61.

                                                      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

                                                        [kAfterAsyncWrite]({ bytes }) {
                                                          this[kState].writeQueueSize -= bytes;
                                                      
                                                          if (this.session !== undefined)
                                                            this.session[kState].writeQueueSize -= bytes;
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 1927..1932

                                                      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 61.

                                                      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 submitGoaway(code, lastStreamID, opaqueData) {
                                                        if (this.destroyed)
                                                          return;
                                                        debugSessionObj(this, 'submitting goaway');
                                                        this[kUpdateTimer]();
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 801..807

                                                      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 onPipedFileHandleRead() {
                                                        const err = streamBaseState[kReadBytesOrError];
                                                        if (err < 0 && err !== UV_EOF) {
                                                          this.stream.close(NGHTTP2_INTERNAL_ERROR);
                                                        }
                                                      Severity: Major
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                      current/lib/internal/http2/core.js on lines 2241..2246

                                                      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

                                                        get state() {
                                                          const id = this[kID];
                                                          if (this.destroyed || id === undefined)
                                                            return {};
                                                          return getStreamState(this[kHandle], id);
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 55 mins to fix
                                                      current/lib/internal/http2/core.js on lines 1915..1920

                                                      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 53.

                                                      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 afterShutdown(status) {
                                                        // Currently this status value is unused
                                                        this.callback();
                                                        const stream = this.handle[kOwner];
                                                        if (stream)
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 45 mins to fix
                                                      current/lib/internal/http2/core.js on lines 1694..1700

                                                      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

                                                        get socket() {
                                                          const proxySocket = this[kProxySocket];
                                                          if (proxySocket === null)
                                                            return this[kProxySocket] = new Proxy(this, proxySocketHandler);
                                                          return proxySocket;
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 45 mins to fix
                                                      current/lib/internal/http2/core.js on lines 1285..1290

                                                      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

                                                      function createServer(options, handler) {
                                                        if (typeof options === 'function') {
                                                          handler = options;
                                                          options = {};
                                                        }
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 45 mins to fix
                                                      current/lib/internal/http2/core.js on lines 3057..3063

                                                      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

                                                      function getPackedSettings(settings) {
                                                        assertIsObject(settings, 'settings');
                                                        validateSettings(settings);
                                                        updateSettingsBuffer({ ...settings });
                                                        return binding.packSettings();
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 40 mins to fix
                                                      current/lib/internal/http2/core.js on lines 3068..3073

                                                      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

                                                        get originSet() {
                                                          if (!this.encrypted || this.destroyed)
                                                            return undefined;
                                                          return ArrayFrom(initOriginSet(this));
                                                        }
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 40 mins to fix
                                                      current/lib/internal/http2/core.js on lines 1197..1201

                                                      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 48.

                                                      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 sessionOnStream(stream, headers, flags, rawHeaders) {
                                                        if (this[kServer] !== undefined)
                                                          this[kServer].emit('stream', stream, headers, flags, rawHeaders);
                                                      }
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 35 mins to fix
                                                      current/lib/internal/http2/core.js on lines 2767..2770

                                                      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

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

                                                      function submitRstStream(code) {
                                                        if (this[kHandle] !== undefined) {
                                                          this[kHandle].rstStream(code);
                                                        }
                                                      }
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 30 mins to fix
                                                      current/lib/internal/http2/core.js on lines 396..400

                                                      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 45.

                                                      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

                                                        [kUpdateTimer]() {
                                                          if (this.destroyed)
                                                            return;
                                                          if (this[kTimeout]) this[kTimeout].refresh();
                                                        }
                                                      Severity: Minor
                                                      Found in lts/lib/internal/http2/core.js and 1 other location - About 30 mins to fix
                                                      current/lib/internal/http2/core.js on lines 1219..1223

                                                      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 45.

                                                      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