enclose-io/compiler

View on GitHub
lts/lib/net.js

Summary

Maintainability
F
2 mos
Test Coverage

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

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
Severity: Major
Found in lts/lib/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 lts/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 32 (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 lts/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 lts/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 79 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 lts/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 lts/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 lts/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 lts/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 lts/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 lts/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 lts/lib/net.js - About 1 hr to fix

                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 lts/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 lts/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 lts/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 lts/lib/net.js - About 1 hr to fix

                    Function afterConnect has a Cognitive Complexity of 12 (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 lts/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 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 lts/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 afterConnect has 34 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 lts/lib/net.js - About 1 hr to fix

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

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

                        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 lts/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 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 lts/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 lts/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 lts/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 lts/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 lts/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 lts/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 lts/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 lts/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 lts/lib/net.js - About 50 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 lts/lib/net.js - About 45 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 lts/lib/net.js - About 45 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 lts/lib/net.js - About 35 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 lts/lib/net.js - About 35 mins to fix

                                          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 lts/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 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 lts/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 lts/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 this;
                                          Severity: Major
                                          Found in lts/lib/net.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

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

                                              Avoid too many return statements within this function.
                                              Open

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

                                                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 lts/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 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 lts/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 lts/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 lts/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 lts/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 lts/lib/net.js and 1 other location - About 4 days to fix
                                                current/lib/net.js on lines 1396..1492

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 days to fix
                                                current/lib/net.js on lines 983..1070

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 2 days to fix
                                                current/lib/net.js on lines 866..925

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 2 days to fix
                                                current/lib/net.js on lines 1269..1338

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 2 days to fix
                                                current/lib/net.js on lines 306..358

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 2 days to fix
                                                current/lib/net.js on lines 1211..1267

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 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 lts/lib/net.js and 1 other location - About 2 days to fix
                                                current/lib/net.js on lines 928..980

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 day to fix
                                                current/lib/net.js on lines 1158..1203

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 day to fix
                                                current/lib/net.js on lines 807..842

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 day to fix
                                                current/lib/net.js on lines 1600..1637

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 day to fix
                                                current/lib/net.js on lines 202..235

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 day to fix
                                                current/lib/net.js on lines 1562..1597

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 day to fix
                                                current/lib/net.js on lines 1354..1393

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 day to fix
                                                current/lib/net.js on lines 759..788

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 day to fix
                                                current/lib/net.js on lines 403..425

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 7 hrs to fix
                                                current/lib/net.js on lines 1529..1559

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 7 hrs to fix
                                                current/lib/net.js on lines 663..682

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 7 hrs to fix
                                                current/lib/net.js on lines 1716..1749

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 7 hrs to fix
                                                current/lib/net.js on lines 239..261

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 5 hrs to fix
                                                current/lib/net.js on lines 487..502

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 5 hrs to fix
                                                current/lib/net.js on lines 597..608

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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) {
                                                    self.readable = readable;
                                                    if (!self._writableState.ended)
                                                      self.writable = writable;
                                                    self._unrefTimer();
                                                Severity: Major
                                                Found in lts/lib/net.js and 1 other location - About 4 hrs to fix
                                                current/lib/net.js on lines 1120..1154

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 4 hrs to fix
                                                current/lib/net.js on lines 845..863

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 4 hrs to fix
                                                current/lib/net.js on lines 469..484

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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._getsockname = function() {
                                                  if (!this._handle || !this._handle.getsockname) {
                                                    return {};
                                                  }
                                                  if (!this._sockname) {
                                                Severity: Major
                                                Found in lts/lib/net.js and 1 other location - About 4 hrs to fix
                                                current/lib/net.js on lines 731..742

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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._getpeername = function() {
                                                  if (!this._peername) {
                                                    if (!this._handle || !this._handle.getpeername) {
                                                      return {};
                                                    }
                                                Severity: Major
                                                Found in lts/lib/net.js and 1 other location - About 4 hrs to fix
                                                current/lib/net.js on lines 693..704

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 4 hrs to fix
                                                current/lib/net.js on lines 449..464

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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

                                                ObjectDefineProperty(Socket.prototype, 'readyState', {
                                                  get: function() {
                                                    if (this.connecting) {
                                                      return 'opening';
                                                    } else if (this.readable && this.writable) {
                                                Severity: Major
                                                Found in lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 537..550

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 onReadableStreamEnd() {
                                                  if (!this.allowHalfOpen) {
                                                    this.write = writeAfterFIN;
                                                    if (this.writable)
                                                      this.end();
                                                Severity: Major
                                                Found in lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 630..639

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 178..189

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 1515..1527

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 110.

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

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

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

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

                                                Refactorings

                                                Further Reading

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

                                                  if (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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 370..379

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 578..587

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 afterShutdown(status) {
                                                  const self = this.handle[owner_symbol];
                                                
                                                  debug('afterShutdown destroyed=%j', self.destroyed,
                                                        self._readableState);
                                                Severity: Major
                                                Found in lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 428..444

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 1494..1505

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 132..148

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 505..515

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 1686..1693

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 3 hrs to fix
                                                current/lib/net.js on lines 620..626

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 2 hrs to fix
                                                current/lib/net.js on lines 611..617

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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.unref = function() {
                                                  if (!this._handle) {
                                                    this.once('connect', this.unref);
                                                    return this;
                                                  }
                                                Severity: Major
                                                Found in lts/lib/net.js and 3 other locations - About 2 hrs to fix
                                                current/lib/net.js on lines 1078..1089
                                                current/lib/net.js on lines 1092..1103
                                                lts/lib/net.js on lines 1079..1090

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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.ref = function() {
                                                  if (!this._handle) {
                                                    this.once('connect', this.ref);
                                                    return this;
                                                  }
                                                Severity: Major
                                                Found in lts/lib/net.js and 3 other locations - About 2 hrs to fix
                                                current/lib/net.js on lines 1078..1089
                                                current/lib/net.js on lines 1092..1103
                                                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 lts/lib/net.js and 1 other location - About 2 hrs to fix
                                                current/lib/net.js on lines 1639..1652

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 2 hrs to fix
                                                current/lib/net.js on lines 393..398

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 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 lts/lib/net.js and 1 other location - About 1 hr to fix
                                                current/lib/net.js on lines 1751..1764

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 hr to fix
                                                current/lib/net.js on lines 568..575

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 hr to fix
                                                current/lib/net.js on lines 642..650

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 hr to fix
                                                current/lib/net.js on lines 1661..1671

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 hr to fix
                                                current/lib/net.js on lines 684..690

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 1 hr to fix
                                                current/lib/net.js on lines 590..594

                                                Duplicated Code

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

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

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

                                                Tuning

                                                This issue has a mass of 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 lts/lib/net.js and 3 other locations - About 1 hr to fix
                                                current/lib/net.js on lines 1695..1702
                                                current/lib/net.js on lines 1704..1711
                                                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 lts/lib/net.js and 3 other locations - About 1 hr to fix
                                                current/lib/net.js on lines 1695..1702
                                                current/lib/net.js on lines 1704..1711
                                                lts/lib/net.js on lines 1692..1699

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/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
                                                current/lib/net.js on lines 1676..1679
                                                lts/lib/dgram.js on lines 1017..1020

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/lib/net.js and 1 other location - About 40 mins to fix
                                                current/lib/net.js on lines 1681..1684

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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 lts/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/net.js on lines 24..33
                                                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/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 lts/lib/net.js and 1 other location - About 30 mins to fix
                                                current/lib/net.js on lines 1507..1513

                                                Duplicated Code

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

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

                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both 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