enclose-io/compiler

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

Summary

Maintainability
F
3 mos
Test Coverage

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

'use strict';

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

const {
Severity: Major
Found in current/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 current/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 current/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;
        options.autoDestroy = false;
    Severity: Minor
    Found in current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/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 current/lib/internal/http2/core.js - About 1 hr to fix

                                      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 current/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 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 current/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 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 current/lib/internal/http2/core.js - About 1 hr to fix

                                        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 current/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 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 current/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 processHeaders has a Cognitive Complexity of 9 (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 current/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 constructor has a Cognitive Complexity of 9 (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 current/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 current/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 doSendFileFD has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

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

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

                                          function doSendFD(session, options, fd, headers, streamOptions, err, stat) {
                                          Severity: Major
                                          Found in current/lib/internal/http2/core.js - About 50 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 current/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 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 current/lib/internal/http2/core.js - About 45 mins to fix

                                              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 current/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 afterOpen has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

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

                                                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 current/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 current/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 current/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 current/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 current/lib/internal/http2/core.js - About 35 mins to fix

                                                    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 current/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 current/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 current/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 current/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 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 current/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 current/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 current/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 current/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 current/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 current/lib/internal/http2/core.js and 1 other location - About 1 wk to fix
                                                    lts/lib/internal/http2/core.js on lines 2403..2705

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 days to fix
                                                    lts/lib/internal/http2/core.js on lines 1471..1569

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 days to fix
                                                    lts/lib/internal/http2/core.js on lines 1575..1662

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 days to fix
                                                    lts/lib/internal/http2/core.js on lines 305..378

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 days to fix
                                                    lts/lib/internal/http2/core.js on lines 2313..2380

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 days to fix
                                                    lts/lib/internal/http2/core.js on lines 944..1009

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 days to fix
                                                    lts/lib/internal/http2/core.js on lines 1071..1138

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 days to fix
                                                    lts/lib/internal/http2/core.js on lines 2970..3025

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 days to fix
                                                    lts/lib/internal/http2/core.js on lines 2076..2121

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 2776..2821

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 826..884

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 666..725

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 3058..3100

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 734..758

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 2912..2944

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 2276..2311

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 1711..1742

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 234..280

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 day to fix
                                                    lts/lib/internal/http2/core.js on lines 2823..2850

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2231..2259

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 911..938

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1202..1228

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2124..2152

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 7 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 430..452

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 6 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1807..1822

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 6 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 584..600

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 6 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1964..1980

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 6 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1920..1954

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2155..2177

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2957..2968

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2017..2037

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1310..1328

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1334..1352

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 602..614

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 5 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2056..2070

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 622..647

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2382..2401

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 767..781

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 410..428

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1293..1307

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 547..559

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 4 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1982..1996

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1824..1837

                                                    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.destroy();
                                                      } else {
                                                        // Wait for end to destroy.
                                                    Severity: Major
                                                    Found in current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 509..528

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1230..1243

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 798..812

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1413..1422

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2736..2746

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1998..2015

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2261..2274

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1689..1705

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 563..572

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1438..1449

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 3 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2852..2860

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 784..793

                                                    Duplicated Code

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

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

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

                                                    Tuning

                                                    This issue has a mass of 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 current/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 389..398

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1189..1197

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2214..2220

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 534..542

                                                    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

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1281..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 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 current/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 1744..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 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 current/lib/internal/http2/core.js and 1 other location - About 2 hrs to fix
                                                    lts/lib/internal/http2/core.js on lines 2709..2717

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 3118..3130

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

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

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 892..900

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 2767..2774

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 469..480

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 482..489

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 1664..1669

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 574..582

                                                    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 current/lib/internal/http2/core.js and 3 other locations - About 1 hr to fix
                                                    current/lib/internal/http2/core.js on lines 2918..2926
                                                    lts/lib/internal/http2/core.js on lines 2879..2887
                                                    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 current/lib/internal/http2/core.js and 3 other locations - About 1 hr to fix
                                                    current/lib/internal/http2/core.js on lines 2896..2904
                                                    lts/lib/internal/http2/core.js on lines 2879..2887
                                                    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 2 locations. Consider refactoring.
                                                    Open

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

                                                    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

                                                      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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 2187..2194

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 1913..1918

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 3028..3034

                                                    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

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

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 818..824

                                                    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

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

                                                    const {
                                                      kBitfield,
                                                      kSessionPriorityListenerCount,
                                                      kSessionFrameErrorListenerCount,
                                                      kSessionMaxInvalidFrames,
                                                    Severity: Major
                                                    Found in current/lib/internal/http2/core.js and 9 other locations - About 1 hr to fix
                                                    current/lib/internal/source_map/source_map_cache.js on lines 3..14
                                                    lts/lib/internal/source_map/source_map_cache.js on lines 3..14
                                                    current/lib/internal/event_target.js on lines 3..14
                                                    current/lib/internal/worker.js on lines 33..44
                                                    current/lib/readline.js on lines 30..41
                                                    current/lib/util.js on lines 24..35
                                                    lts/lib/internal/worker.js on lines 33..44
                                                    lts/lib/readline.js on lines 30..41
                                                    lts/lib/util.js on lines 24..35

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

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 1 hr to fix
                                                    lts/lib/internal/http2/core.js on lines 2224..2229

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 55 mins to fix
                                                    lts/lib/internal/http2/core.js on lines 1901..1906

                                                    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

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

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 45 mins to fix
                                                    lts/lib/internal/http2/core.js on lines 3040..3046

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

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 40 mins to fix
                                                    lts/lib/internal/http2/core.js on lines 3051..3056

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 40 mins to fix
                                                    lts/lib/internal/http2/core.js on lines 1158..1162

                                                    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 current/lib/internal/http2/core.js and 1 other location - About 35 mins to fix
                                                    lts/lib/internal/http2/core.js on lines 2750..2753

                                                    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

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

                                                    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

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

                                                    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