enclose-io/compiler

View on GitHub
current/lib/net.js

Summary

Maintainability
F
2 mos
Test Coverage

File net.js has 1296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Severity: Major
Found in current/lib/net.js - About 3 days to fix

    Function listen has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    Server.prototype.listen = function(...args) {
      const normalized = normalizeArgs(args);
      let options = normalized[0];
      const cb = normalized[1];
    
    
    Severity: Minor
    Found in current/lib/net.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 Socket has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    function Socket(options) {
      if (!(this instanceof Socket)) return new Socket(options);
    
      this.connecting = false;
      // Problem with this is that users can supply their own handle, that may not
    Severity: Minor
    Found in current/lib/net.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 createServerHandle has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    function createServerHandle(address, port, addressType, fd, flags) {
      let err = 0;
      // Assign handle in listen, and clean up if bind or listen fails
      let handle;
    
    
    Severity: Minor
    Found in current/lib/net.js - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function Socket has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Socket(options) {
      if (!(this instanceof Socket)) return new Socket(options);
    
      this.connecting = false;
      // Problem with this is that users can supply their own handle, that may not
    Severity: Major
    Found in current/lib/net.js - About 3 hrs to fix

      Function listen has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Server.prototype.listen = function(...args) {
        const normalized = normalizeArgs(args);
        let options = normalized[0];
        const cb = normalized[1];
      
      
      Severity: Major
      Found in current/lib/net.js - About 2 hrs to fix

        Function lookupAndConnect has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function lookupAndConnect(self, options) {
          const { localAddress, localPort } = options;
          const host = options.host || 'localhost';
          let { port } = options;
        
        
        Severity: Major
        Found in current/lib/net.js - About 2 hrs to fix

          Function setupListenHandle has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          function setupListenHandle(address, port, addressType, backlog, fd, flags) {
            debug('setupListenHandle', address, port, addressType, backlog, fd);
          
            // If there is not yet a handle, we need to create one and bind.
            // In the case of a server sent via IPC, we don't need to do this.
          Severity: Minor
          Found in current/lib/net.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 setupListenHandle has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function setupListenHandle(address, port, addressType, backlog, fd, flags) {
            debug('setupListenHandle', address, port, addressType, backlog, fd);
          
            // If there is not yet a handle, we need to create one and bind.
            // In the case of a server sent via IPC, we don't need to do this.
          Severity: Minor
          Found in current/lib/net.js - About 1 hr to fix

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

            function createServerHandle(address, port, addressType, fd, flags) {
              let err = 0;
              // Assign handle in listen, and clean up if bind or listen fails
              let handle;
            
            
            Severity: Minor
            Found in current/lib/net.js - About 1 hr to fix

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

              function internalConnect(
                self, address, port, addressType, localAddress, localPort, flags) {
                // TODO return promise from Socket.prototype.connect which
                // wraps _connectReq.
              
              
              Severity: Minor
              Found in current/lib/net.js - About 1 hr to fix

                Function afterConnect has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function afterConnect(status, handle, req, readable, writable) {
                  const self = handle[owner_symbol];
                
                  // Callback may come after call to destroy
                  if (self.destroyed) {
                Severity: Minor
                Found in current/lib/net.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 internalConnect has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function internalConnect(
                  self, address, port, addressType, localAddress, localPort, flags) {
                  // TODO return promise from Socket.prototype.connect which
                  // wraps _connectReq.
                
                
                Severity: Minor
                Found in current/lib/net.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 lookupAndConnect has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function lookupAndConnect(self, options) {
                  const { localAddress, localPort } = options;
                  const host = options.host || 'localhost';
                  let { port } = options;
                
                
                Severity: Minor
                Found in current/lib/net.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 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Socket.prototype.connect = function(...args) {
                  let normalized;
                  // If passed an array, it's treated as an array of arguments that have
                  // already been normalized (so we don't normalize more than once). This has
                  // been solved before in https://github.com/nodejs/node/pull/12342, but was
                Severity: Minor
                Found in current/lib/net.js - About 1 hr to fix

                  Function afterConnect has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function afterConnect(status, handle, req, readable, writable) {
                    const self = handle[owner_symbol];
                  
                    // Callback may come after call to destroy
                    if (self.destroyed) {
                  Severity: Minor
                  Found in current/lib/net.js - About 1 hr to fix

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

                    function Server(options, connectionListener) {
                      if (!(this instanceof Server))
                        return new Server(options, connectionListener);
                    
                      EventEmitter.call(this);
                    Severity: Minor
                    Found in current/lib/net.js - About 1 hr to fix

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

                      Server.prototype.close = function(cb) {
                        if (typeof cb === 'function') {
                          if (!this._handle) {
                            this.once('close', function close() {
                              cb(new ERR_SERVER_NOT_RUNNING());
                      Severity: Minor
                      Found in current/lib/net.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 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Socket.prototype.connect = function(...args) {
                        let normalized;
                        // If passed an array, it's treated as an array of arguments that have
                        // already been normalized (so we don't normalize more than once). This has
                        // been solved before in https://github.com/nodejs/node/pull/12342, but was
                      Severity: Minor
                      Found in current/lib/net.js - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                      Socket.prototype._destroy = function(exception, cb) {
                        debug('destroy');
                      
                        this.connecting = false;
                      
                      
                      Severity: Minor
                      Found in current/lib/net.js - About 1 hr to fix

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

                        protoGetter('bytesWritten', function bytesWritten() {
                          let bytes = this._bytesDispatched;
                          const state = this._writableState;
                          const data = this._pendingData;
                          const encoding = this._pendingEncoding;
                        Severity: Minor
                        Found in current/lib/net.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 initSocketHandle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function initSocketHandle(self) {
                          self._undestroy();
                          self._sockname = null;
                        
                          // Handle creation may be deferred to bind() or connect() time.
                        Severity: Minor
                        Found in current/lib/net.js - About 1 hr to fix

                        Cognitive Complexity

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

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

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

                        Further reading

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

                        Socket.prototype._destroy = function(exception, cb) {
                          debug('destroy');
                        
                          this.connecting = false;
                        
                        
                        Severity: Minor
                        Found in current/lib/net.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 bytesWritten has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        protoGetter('bytesWritten', function bytesWritten() {
                          let bytes = this._bytesDispatched;
                          const state = this._writableState;
                          const data = this._pendingData;
                          const encoding = this._pendingEncoding;
                        Severity: Minor
                        Found in current/lib/net.js - About 1 hr to fix

                          Function close has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Server.prototype.close = function(cb) {
                            if (typeof cb === 'function') {
                              if (!this._handle) {
                                this.once('close', function close() {
                                  cb(new ERR_SERVER_NOT_RUNNING());
                          Severity: Minor
                          Found in current/lib/net.js - About 1 hr to fix

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

                            Server.prototype.getConnections = function(cb) {
                              const self = this;
                            
                              function end(err, connections) {
                                defaultTriggerAsyncIdScope(self[async_id_symbol],
                            Severity: Minor
                            Found in current/lib/net.js - About 1 hr to fix

                              Function listenInCluster has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function listenInCluster(server, address, port, addressType,
                                                       backlog, fd, exclusive, flags) {
                              Severity: Major
                              Found in current/lib/net.js - About 1 hr to fix

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

                                function Server(options, connectionListener) {
                                  if (!(this instanceof Server))
                                    return new Server(options, connectionListener);
                                
                                  EventEmitter.call(this);
                                Severity: Minor
                                Found in current/lib/net.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 internalConnect has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  self, address, port, addressType, localAddress, localPort, flags) {
                                Severity: Major
                                Found in current/lib/net.js - About 50 mins to fix

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

                                  function setupListenHandle(address, port, addressType, backlog, fd, flags) {
                                  Severity: Minor
                                  Found in current/lib/net.js - About 45 mins to fix

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

                                    function lookupAndListen(self, port, address, backlog, exclusive, flags) {
                                    Severity: Minor
                                    Found in current/lib/net.js - About 45 mins to fix

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

                                      function createServerHandle(address, port, addressType, fd, flags) {
                                      Severity: Minor
                                      Found in current/lib/net.js - About 35 mins to fix

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

                                        function afterConnect(status, handle, req, readable, writable) {
                                        Severity: Minor
                                        Found in current/lib/net.js - About 35 mins to fix

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

                                          function normalizeArgs(args) {
                                            let arr;
                                          
                                            if (args.length === 0) {
                                              arr = [{}, null];
                                          Severity: Minor
                                          Found in current/lib/net.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 pause has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                          Socket.prototype.pause = function() {
                                            if (this[kBuffer] && !this.connecting && this._handle &&
                                                this._handle.reading) {
                                              this._handle.reading = false;
                                              if (!this.destroyed) {
                                          Severity: Minor
                                          Found in current/lib/net.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 lookupAndListen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                          function lookupAndListen(self, port, address, backlog, exclusive, flags) {
                                            if (dns === undefined) dns = require('dns');
                                            dns.lookup(address, function doListen(err, ip, addressType) {
                                              if (err) {
                                                self.emit('error', err);
                                          Severity: Minor
                                          Found in current/lib/net.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

                                          Avoid too many return statements within this function.
                                          Open

                                            return handle;
                                          Severity: Major
                                          Found in current/lib/net.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                return this;
                                            Severity: Major
                                            Found in current/lib/net.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                  return 'closed';
                                              Severity: Major
                                              Found in current/lib/net.js - About 30 mins to fix

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

                                                Server.prototype.getConnections = function(cb) {
                                                  const self = this;
                                                
                                                  function end(err, connections) {
                                                    defaultTriggerAsyncIdScope(self[async_id_symbol],
                                                Severity: Minor
                                                Found in current/lib/net.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 createHandle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                function createHandle(fd, is_server) {
                                                  validateInt32(fd, 'fd', 0);
                                                  const type = guessHandleType(fd);
                                                  if (type === 'PIPE') {
                                                    return new Pipe(
                                                Severity: Minor
                                                Found in current/lib/net.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 setNoDelay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                Socket.prototype.setNoDelay = function(enable) {
                                                  if (!this._handle) {
                                                    this.once('connect',
                                                              enable ? this.setNoDelay : () => this.setNoDelay(enable));
                                                    return this;
                                                Severity: Minor
                                                Found in current/lib/net.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 _getpeername has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                Socket.prototype._getpeername = function() {
                                                  if (!this._peername) {
                                                    if (!this._handle || !this._handle.getpeername) {
                                                      return {};
                                                    }
                                                Severity: Minor
                                                Found in current/lib/net.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 _final has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                Socket.prototype._final = function(cb) {
                                                  // If still connecting - defer handling `_final` until 'connect' will happen
                                                  if (this.pending) {
                                                    debug('_final: not yet connected');
                                                    return this.once('connect', () => this._final(cb));
                                                Severity: Minor
                                                Found in current/lib/net.js - About 25 mins to fix

                                                Cognitive Complexity

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

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

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

                                                Further reading

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

                                                Server.prototype.listen = function(...args) {
                                                  const normalized = normalizeArgs(args);
                                                  let options = normalized[0];
                                                  const cb = normalized[1];
                                                
                                                
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 4 days to fix
                                                lts/lib/net.js on lines 1393..1489

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

                                                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 lookupAndConnect(self, options) {
                                                  const { localAddress, localPort } = options;
                                                  const host = options.host || 'localhost';
                                                  let { port } = options;
                                                
                                                
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 days to fix
                                                lts/lib/net.js on lines 984..1071

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

                                                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 internalConnect(
                                                  self, address, port, addressType, localAddress, localPort, flags) {
                                                  // TODO return promise from Socket.prototype.connect which
                                                  // wraps _connectReq.
                                                
                                                
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 2 days to fix
                                                lts/lib/net.js on lines 867..926

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

                                                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 setupListenHandle(address, port, addressType, backlog, fd, flags) {
                                                  debug('setupListenHandle', address, port, addressType, backlog, fd);
                                                
                                                  // If there is not yet a handle, we need to create one and bind.
                                                  // In the case of a server sent via IPC, we don't need to do this.
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 2 days to fix
                                                lts/lib/net.js on lines 1266..1335

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                  if (options.handle) {
                                                    this._handle = options.handle; // private
                                                    this[async_id_symbol] = getNewAsyncId(this._handle);
                                                  } else {
                                                    const onread = options.onread;
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 2 days to fix
                                                lts/lib/net.js on lines 305..357

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 448.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                function createServerHandle(address, port, addressType, fd, flags) {
                                                  let err = 0;
                                                  // Assign handle in listen, and clean up if bind or listen fails
                                                  let handle;
                                                
                                                
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 2 days to fix
                                                lts/lib/net.js on lines 1208..1264

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

                                                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

                                                Socket.prototype.connect = function(...args) {
                                                  let normalized;
                                                  // If passed an array, it's treated as an array of arguments that have
                                                  // already been normalized (so we don't normalize more than once). This has
                                                  // been solved before in https://github.com/nodejs/node/pull/12342, but was
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 2 days to fix
                                                lts/lib/net.js on lines 929..981

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

                                                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 Server(options, connectionListener) {
                                                  if (!(this instanceof Server))
                                                    return new Server(options, connectionListener);
                                                
                                                  EventEmitter.call(this);
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 day to fix
                                                lts/lib/net.js on lines 1155..1200

                                                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

                                                protoGetter('bytesWritten', function bytesWritten() {
                                                  let bytes = this._bytesDispatched;
                                                  const state = this._writableState;
                                                  const data = this._pendingData;
                                                  const encoding = this._pendingEncoding;
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 day to fix
                                                lts/lib/net.js on lines 808..843

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Server.prototype.close = function(cb) {
                                                  if (typeof cb === 'function') {
                                                    if (!this._handle) {
                                                      this.once('close', function close() {
                                                        cb(new ERR_SERVER_NOT_RUNNING());
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 day to fix
                                                lts/lib/net.js on lines 1597..1634

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

                                                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 normalizeArgs(args) {
                                                  let arr;
                                                
                                                  if (args.length === 0) {
                                                    arr = [{}, null];
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 day to fix
                                                lts/lib/net.js on lines 200..233

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 266.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Server.prototype.getConnections = function(cb) {
                                                  const self = this;
                                                
                                                  function end(err, connections) {
                                                    defaultTriggerAsyncIdScope(self[async_id_symbol],
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 day to fix
                                                lts/lib/net.js on lines 1559..1594

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

                                                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 listenInCluster(server, address, port, addressType,
                                                                         backlog, fd, exclusive, flags) {
                                                  exclusive = !!exclusive;
                                                
                                                  if (cluster === undefined) cluster = require('cluster');
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 day to fix
                                                lts/lib/net.js on lines 1351..1390

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

                                                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

                                                Socket.prototype._writeGeneric = function(writev, data, encoding, cb) {
                                                  // If we are still connecting, then buffer this for later.
                                                  // The Writable logic will buffer up any more writes while
                                                  // waiting for this one to be done.
                                                  if (this.connecting) {
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 day to fix
                                                lts/lib/net.js on lines 760..789

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

                                                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

                                                Socket.prototype._final = function(cb) {
                                                  // If still connecting - defer handling `_final` until 'connect' will happen
                                                  if (this.pending) {
                                                    debug('_final: not yet connected');
                                                    return this.once('connect', () => this._final(cb));
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 day to fix
                                                lts/lib/net.js on lines 402..424

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 211.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                function onconnection(err, clientHandle) {
                                                  const handle = this;
                                                  const self = handle[owner_symbol];
                                                
                                                  debug('onconnection');
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 7 hrs to fix
                                                lts/lib/net.js on lines 1526..1556

                                                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

                                                  if (this._handle) {
                                                    if (this !== process.stderr)
                                                      debug('close handle');
                                                    const isException = exception ? true : false;
                                                    // `bytesRead` and `kBytesWritten` should be accessible after `.destroy()`
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 7 hrs to fix
                                                lts/lib/net.js on lines 664..683

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                if (isWindows) {
                                                  let simultaneousAccepts;
                                                
                                                  _setSimultaneousAccepts = function(handle) {
                                                    if (warnSimultaneousAccepts) {
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 7 hrs to fix
                                                lts/lib/net.js on lines 1713..1746

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

                                                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 initSocketHandle(self) {
                                                  self._undestroy();
                                                  self._sockname = null;
                                                
                                                  // Handle creation may be deferred to bind() or connect() time.
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 7 hrs to fix
                                                lts/lib/net.js on lines 237..259

                                                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

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

                                                Socket.prototype.setNoDelay = function(enable) {
                                                  if (!this._handle) {
                                                    this.once('connect',
                                                              enable ? this.setNoDelay : () => this.setNoDelay(enable));
                                                    return this;
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 5 hrs to fix
                                                lts/lib/net.js on lines 486..501

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 151.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Socket.prototype.pause = function() {
                                                  if (this[kBuffer] && !this.connecting && this._handle &&
                                                      this._handle.reading) {
                                                    this._handle.reading = false;
                                                    if (!this.destroyed) {
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 5 hrs to fix
                                                lts/lib/net.js on lines 596..607

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

                                                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 (status === 0) {
                                                    if (self.readable && !readable) {
                                                      self.push(null);
                                                      self.read();
                                                    }
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 4 hrs to fix
                                                lts/lib/net.js on lines 1121..1151

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

                                                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 checkBindError(err, port, handle) {
                                                  // EADDRINUSE may not be reported until we call listen() or connect().
                                                  // To complicate matters, a failed bind() followed by listen() or connect()
                                                  // will implicitly bind to a random port. Ergo, check that the socket is
                                                  // bound to the expected port before calling listen() or connect().
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 4 hrs to fix
                                                lts/lib/net.js on lines 846..864

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

                                                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

                                                Socket.prototype._onTimeout = function() {
                                                  const handle = this._handle;
                                                  const lastWriteQueueSize = this[kLastWriteQueueSize];
                                                  if (lastWriteQueueSize > 0 && handle) {
                                                    // `lastWriteQueueSize !== writeQueueSize` means there is
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 4 hrs to fix
                                                lts/lib/net.js on lines 468..483

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 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

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

                                                Socket.prototype._getpeername = function() {
                                                  if (!this._peername) {
                                                    if (!this._handle || !this._handle.getpeername) {
                                                      return {};
                                                    }
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 4 hrs to fix
                                                lts/lib/net.js on lines 694..705

                                                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

                                                Socket.prototype._getsockname = function() {
                                                  if (!this._handle || !this._handle.getsockname) {
                                                    return {};
                                                  }
                                                  if (!this._sockname) {
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 4 hrs to fix
                                                lts/lib/net.js on lines 732..743

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 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 writeAfterFIN(chunk, encoding, cb) {
                                                  if (typeof encoding === 'function') {
                                                    cb = encoding;
                                                    encoding = null;
                                                  }
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 4 hrs to fix
                                                lts/lib/net.js on lines 448..463

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

                                                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 onReadableStreamEnd() {
                                                  if (!this.allowHalfOpen) {
                                                    this.write = writeAfterFIN;
                                                    if (this.writable)
                                                      this.end();
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 629..638

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

                                                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(Socket.prototype, 'readyState', {
                                                  get: function() {
                                                    if (this.connecting) {
                                                      return 'opening';
                                                    } else if (this.readable && this.writable) {
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 536..549

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

                                                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 connect(...args) {
                                                  const normalized = normalizeArgs(args);
                                                  const options = normalized[0];
                                                  debug('createConnection', normalized);
                                                  const socket = new Socket(options);
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 176..187

                                                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

                                                Server.prototype.address = function() {
                                                  if (this._handle && this._handle.getsockname) {
                                                    const out = {};
                                                    const err = this._handle.getsockname(out);
                                                    if (err) {
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 1512..1524

                                                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

                                                function afterShutdown(status) {
                                                  const self = this.handle[owner_symbol];
                                                
                                                  debug('afterShutdown destroyed=%j', self.destroyed,
                                                        self._readableState);
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 427..443

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

                                                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 (this._handle && options.readable !== false) {
                                                    if (options.pauseOnCreate) {
                                                      // Stop the handle from reading and pause the stream
                                                      this._handle.reading = false;
                                                      this._handle.readStop();
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 369..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 106.

                                                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

                                                Socket.prototype._read = function(n) {
                                                  debug('_read');
                                                
                                                  if (this.connecting || !this._handle) {
                                                    debug('_read wait for connection');
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 577..586

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

                                                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 lookupAndListen(self, port, address, backlog, exclusive, flags) {
                                                  if (dns === undefined) dns = require('dns');
                                                  dns.lookup(address, function doListen(err, ip, addressType) {
                                                    if (err) {
                                                      self.emit('error', err);
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 1491..1502

                                                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 createHandle(fd, is_server) {
                                                  validateInt32(fd, 'fd', 0);
                                                  const type = guessHandleType(fd);
                                                  if (type === 'PIPE') {
                                                    return new Pipe(
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 130..146

                                                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

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

                                                Socket.prototype.setKeepAlive = function(setting, msecs) {
                                                  if (!this._handle) {
                                                    this.once('connect', () => this.setKeepAlive(setting, msecs));
                                                    return this;
                                                  }
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 504..514

                                                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

                                                Server.prototype._setupWorker = function(socketList) {
                                                  this._usingWorkers = true;
                                                  this._workers.push(socketList);
                                                  socketList.once('exit', (socketList) => {
                                                    const index = this._workers.indexOf(socketList);
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 1683..1690

                                                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

                                                Socket.prototype.read = function(n) {
                                                  if (this[kBuffer] && !this.connecting && this._handle &&
                                                      !this._handle.reading) {
                                                    tryReadStart(this);
                                                  }
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 3 hrs to fix
                                                lts/lib/net.js on lines 619..625

                                                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

                                                Socket.prototype.resume = function() {
                                                  if (this[kBuffer] && !this.connecting && this._handle &&
                                                      !this._handle.reading) {
                                                    tryReadStart(this);
                                                  }
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 2 hrs to fix
                                                lts/lib/net.js on lines 610..616

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Socket.prototype.ref = function() {
                                                  if (!this._handle) {
                                                    this.once('connect', this.ref);
                                                    return this;
                                                  }
                                                Severity: Major
                                                Found in current/lib/net.js and 3 other locations - About 2 hrs to fix
                                                current/lib/net.js on lines 1092..1103
                                                lts/lib/net.js on lines 1079..1090
                                                lts/lib/net.js on lines 1093..1104

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Socket.prototype.unref = function() {
                                                  if (!this._handle) {
                                                    this.once('connect', this.unref);
                                                    return this;
                                                  }
                                                Severity: Major
                                                Found in current/lib/net.js and 3 other locations - About 2 hrs to fix
                                                current/lib/net.js on lines 1078..1089
                                                lts/lib/net.js on lines 1079..1090
                                                lts/lib/net.js on lines 1093..1104

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Server.prototype._emitCloseIfDrained = function() {
                                                  debug('SERVER _emitCloseIfDrained');
                                                
                                                  if (this._handle || this._connections) {
                                                    debug('SERVER handle? %j   connections? %d',
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 2 hrs to fix
                                                lts/lib/net.js on lines 1636..1649

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

                                                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

                                                Socket.prototype._unrefTimer = function _unrefTimer() {
                                                  for (let s = this; s !== null; s = s._parent) {
                                                    if (s[kTimeout])
                                                      s[kTimeout].refresh();
                                                  }
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 2 hrs to fix
                                                lts/lib/net.js on lines 392..397

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 78.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                module.exports = {
                                                  _createServerHandle: createServerHandle,
                                                  _normalizeArgs: normalizeArgs,
                                                  _setSimultaneousAccepts,
                                                  connect,
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 hr to fix
                                                lts/lib/net.js on lines 1748..1761

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 74.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                function tryReadStart(socket) {
                                                  // Not already reading, start the flow
                                                  debug('Socket._handle.readStart');
                                                  socket._handle.reading = true;
                                                  const err = socket._handle.readStart();
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 hr to fix
                                                lts/lib/net.js on lines 567..574

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

                                                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

                                                Socket.prototype.destroySoon = function() {
                                                  if (this.writable)
                                                    this.end();
                                                
                                                  if (this.writableFinished)
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 hr to fix
                                                lts/lib/net.js on lines 641..649

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 73.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Server.prototype[EventEmitter.captureRejectionSymbol] = function(
                                                  err, event, sock) {
                                                
                                                  switch (event) {
                                                    case 'connection':
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 hr to fix
                                                lts/lib/net.js on lines 1658..1668

                                                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

                                                  if (this._server) {
                                                    debug('has server');
                                                    this._server._connections--;
                                                    if (this._server._emitCloseIfDrained) {
                                                      this._server._emitCloseIfDrained();
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 hr to fix
                                                lts/lib/net.js on lines 685..691

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 60.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Socket.prototype.end = function(data, encoding, callback) {
                                                  stream.Duplex.prototype.end.call(this, data, encoding, callback);
                                                  DTRACE_NET_STREAM_END(this);
                                                  return this;
                                                };
                                                Severity: Major
                                                Found in current/lib/net.js and 1 other location - About 1 hr to fix
                                                lts/lib/net.js on lines 589..593

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

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                Server.prototype.ref = function() {
                                                  this._unref = false;
                                                
                                                  if (this._handle)
                                                    this._handle.ref();
                                                Severity: Major
                                                Found in current/lib/net.js and 3 other locations - About 1 hr to fix
                                                current/lib/net.js on lines 1704..1711
                                                lts/lib/net.js on lines 1692..1699
                                                lts/lib/net.js on lines 1701..1708

                                                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

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

                                                Server.prototype.unref = function() {
                                                  this._unref = true;
                                                
                                                  if (this._handle)
                                                    this._handle.unref();
                                                Severity: Major
                                                Found in current/lib/net.js and 3 other locations - About 1 hr to fix
                                                current/lib/net.js on lines 1695..1702
                                                lts/lib/net.js on lines 1692..1699
                                                lts/lib/net.js on lines 1701..1708

                                                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

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

                                                ObjectDefineProperty(TCP.prototype, 'owner', {
                                                  get() { return this[owner_symbol]; },
                                                  set(v) { return this[owner_symbol] = v; }
                                                });
                                                Severity: Major
                                                Found in current/lib/net.js and 5 other locations - About 50 mins to fix
                                                current/lib/internal/fs/watchers.js on lines 267..270
                                                lts/lib/internal/fs/watchers.js on lines 202..205
                                                current/lib/dgram.js on lines 1026..1029
                                                lts/lib/dgram.js on lines 1017..1020
                                                lts/lib/net.js on lines 1673..1676

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 52.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                ObjectDefineProperty(Socket.prototype, '_handle', {
                                                  get() { return this[kHandle]; },
                                                  set(v) { return this[kHandle] = v; }
                                                });
                                                Severity: Minor
                                                Found in current/lib/net.js and 1 other location - About 40 mins to fix
                                                lts/lib/net.js on lines 1678..1681

                                                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

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

                                                const {
                                                  ArrayIsArray,
                                                  Boolean,
                                                  Error,
                                                  Number,
                                                Severity: Major
                                                Found in current/lib/net.js and 15 other locations - About 40 mins to fix
                                                current/lib/internal/http2/compat.js on lines 3..12
                                                current/lib/internal/http2/util.js on lines 3..12
                                                lts/lib/internal/http2/compat.js on lines 3..12
                                                lts/lib/internal/http2/util.js on lines 3..12
                                                current/lib/_http_client.js on lines 24..33
                                                current/lib/_http_outgoing.js on lines 24..33
                                                current/lib/_stream_readable.js on lines 24..33
                                                current/lib/assert.js on lines 23..32
                                                current/lib/fs.js on lines 31..40
                                                current/lib/internal/async_hooks.js on lines 3..12
                                                current/lib/perf_hooks.js on lines 3..12
                                                lts/lib/_stream_readable.js on lines 24..33
                                                lts/lib/fs.js on lines 27..36
                                                lts/lib/net.js on lines 24..33
                                                lts/lib/perf_hooks.js on lines 3..12

                                                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

                                                ObjectDefineProperty(Server.prototype, 'listening', {
                                                  get: function() {
                                                    return !!this._handle;
                                                  },
                                                  configurable: true,
                                                Severity: Minor
                                                Found in current/lib/net.js and 1 other location - About 30 mins to fix
                                                lts/lib/net.js on lines 1504..1510

                                                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