enclose-io/compiler

View on GitHub
lts/lib/_tls_wrap.js

Summary

Maintainability
F
1 mo
Test Coverage

File _tls_wrap.js has 1175 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/_tls_wrap.js - About 3 days to fix

    Function _init has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    TLSSocket.prototype._init = function(socket, wrap) {
      const options = this._tlsOptions;
      const ssl = this._handle;
      this.server = options.server;
    
    
    Severity: Minor
    Found in lts/lib/_tls_wrap.js - About 6 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 _init has 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    TLSSocket.prototype._init = function(socket, wrap) {
      const options = this._tlsOptions;
      const ssl = this._handle;
      this.server = options.server;
    
    
    Severity: Major
    Found in lts/lib/_tls_wrap.js - About 4 hrs to fix

      Function setSecureContext has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Server.prototype.setSecureContext = function(options) {
        if (options === null || typeof options !== 'object')
          throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
      
        if (options.pfx)
      Severity: Major
      Found in lts/lib/_tls_wrap.js - About 3 hrs to fix

        Function setOptions has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        Server.prototype.setOptions = deprecate(function(options) {
          this.requestCert = options.requestCert === true;
          this.rejectUnauthorized = options.rejectUnauthorized !== false;
        
          if (options.pfx) this.pfx = options.pfx;
        Severity: Minor
        Found in lts/lib/_tls_wrap.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 setSecureContext has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        Server.prototype.setSecureContext = function(options) {
          if (options === null || typeof options !== 'object')
            throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
        
          if (options.pfx)
        Severity: Minor
        Found in lts/lib/_tls_wrap.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 connect has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.connect = function connect(...args) {
          args = normalizeConnectArgs(args);
          let options = args[0];
          const cb = args[1];
          const allowUnauthorized = getAllowUnauthorized();
        Severity: Major
        Found in lts/lib/_tls_wrap.js - About 2 hrs to fix

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

          function TLSSocket(socket, opts) {
            const tlsOptions = { ...opts };
            let enableTrace = tlsOptions.enableTrace;
          
            if (enableTrace == null) {
          Severity: Major
          Found in lts/lib/_tls_wrap.js - About 2 hrs to fix

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

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

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

              function requestOCSP(socket, info) {
                if (!info.OCSPRequest || !socket.server)
                  return requestOCSPDone(socket);
              
                let ctx = socket._handle.sni_context;
              Severity: Minor
              Found in lts/lib/_tls_wrap.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 onConnectSecure has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function onConnectSecure() {
                const options = this[kConnectOptions];
              
                // Check the size of DHE parameter above minimum requirement
                // specified in options.
              Severity: Minor
              Found in lts/lib/_tls_wrap.js - About 1 hr to fix

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

                TLSSocket.prototype.renegotiate = function(options, callback) {
                  if (options === null || typeof options !== 'object')
                    throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
                  if (callback !== undefined && typeof callback !== 'function')
                    throw new ERR_INVALID_CALLBACK(callback);
                Severity: Minor
                Found in lts/lib/_tls_wrap.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 Server has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function Server(options, listener) {
                  if (!(this instanceof Server))
                    return new Server(options, listener);
                
                  if (typeof options === 'function') {
                Severity: Minor
                Found in lts/lib/_tls_wrap.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 setOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Server.prototype.setOptions = deprecate(function(options) {
                  this.requestCert = options.requestCert === true;
                  this.rejectUnauthorized = options.rejectUnauthorized !== false;
                
                  if (options.pfx) this.pfx = options.pfx;
                Severity: Minor
                Found in lts/lib/_tls_wrap.js - About 1 hr to fix

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

                  TLSSocket.prototype.renegotiate = function(options, callback) {
                    if (options === null || typeof options !== 'object')
                      throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
                    if (callback !== undefined && typeof callback !== 'function')
                      throw new ERR_INVALID_CALLBACK(callback);
                  Severity: Minor
                  Found in lts/lib/_tls_wrap.js - About 1 hr to fix

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

                    function requestOCSP(socket, info) {
                      if (!info.OCSPRequest || !socket.server)
                        return requestOCSPDone(socket);
                    
                      let ctx = socket._handle.sni_context;
                    Severity: Minor
                    Found in lts/lib/_tls_wrap.js - About 1 hr to fix

                      Function TLSSocket has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function TLSSocket(socket, opts) {
                        const tlsOptions = { ...opts };
                        let enableTrace = tlsOptions.enableTrace;
                      
                        if (enableTrace == null) {
                      Severity: Minor
                      Found in lts/lib/_tls_wrap.js - About 1 hr to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Function connect has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.connect = function connect(...args) {
                        args = normalizeConnectArgs(args);
                        let options = args[0];
                        const cb = args[1];
                        const allowUnauthorized = getAllowUnauthorized();
                      Severity: Minor
                      Found in lts/lib/_tls_wrap.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 onConnectSecure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function onConnectSecure() {
                        const options = this[kConnectOptions];
                      
                        // Check the size of DHE parameter above minimum requirement
                        // specified in options.
                      Severity: Minor
                      Found in lts/lib/_tls_wrap.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 onPskServerCallback has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function onPskServerCallback(identity, maxPskLen) {
                        const owner = this[owner_symbol];
                        const ret = owner[kPskCallback](owner, identity);
                        if (ret == null)
                          return undefined;
                      Severity: Minor
                      Found in lts/lib/_tls_wrap.js - About 1 hr to fix

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

                        TLSSocket.prototype._wrapHandle = function(wrap) {
                          let handle;
                        
                          if (wrap)
                            handle = wrap._handle;
                        Severity: Minor
                        Found in lts/lib/_tls_wrap.js - About 1 hr to fix

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

                          function onServerSocketSecure() {
                            if (this._requestCert) {
                              const verifyError = this._handle.verifyError();
                              if (verifyError) {
                                this.authorizationError = verifyError.code;
                          Severity: Minor
                          Found in lts/lib/_tls_wrap.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 loadSession has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function loadSession(hello) {
                            debug('server onclienthello',
                                  'sessionid.len', hello.sessionId.length,
                                  'ticket?', hello.tlsTicket
                            );
                          Severity: Minor
                          Found in lts/lib/_tls_wrap.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 close has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          tls_wrap.TLSWrap.prototype.close = function close(cb) {
                            let ssl;
                            if (this[owner_symbol]) {
                              ssl = this[owner_symbol].ssl;
                              this[owner_symbol].ssl = null;
                          Severity: Minor
                          Found in lts/lib/_tls_wrap.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 onnewsession has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function onnewsession(sessionId, session) {
                            debug('onnewsession');
                            const owner = this[owner_symbol];
                          
                            // TODO(@sam-github) no server to emit the event on, but handshake won't
                          Severity: Minor
                          Found in lts/lib/_tls_wrap.js - About 45 mins to fix

                          Cognitive Complexity

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

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

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

                          Further reading

                          Consider simplifying this complex logical expression.
                          Open

                            if (!verifyError && !this.isSessionReused()) {
                              const hostname = options.servername ||
                                             options.host ||
                                             (options.socket && options.socket._host) ||
                                             'localhost';
                          Severity: Major
                          Found in lts/lib/_tls_wrap.js - About 40 mins to fix

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

                            function onPskServerCallback(identity, maxPskLen) {
                              const owner = this[owner_symbol];
                              const ret = owner[kPskCallback](owner, identity);
                              if (ret == null)
                                return undefined;
                            Severity: Minor
                            Found in lts/lib/_tls_wrap.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 onerror has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function onerror(err) {
                              const owner = this[owner_symbol];
                              debug('%s onerror %s had? %j',
                                    owner._tlsOptions.isServer ? 'server' : 'client', err,
                                    owner._hadError);
                            Severity: Minor
                            Found in lts/lib/_tls_wrap.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 _wrapHandle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            TLSSocket.prototype._wrapHandle = function(wrap) {
                              let handle;
                            
                              if (wrap)
                                handle = wrap._handle;
                            Severity: Minor
                            Found in lts/lib/_tls_wrap.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

                            TLSSocket.prototype._init = function(socket, wrap) {
                              const options = this._tlsOptions;
                              const ssl = this._handle;
                              this.server = options.server;
                            
                            
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 wk to fix
                            current/lib/_tls_wrap.js on lines 650..813

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 1199.

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

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

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

                            See codeclimate-duplication's documentation for more 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.setOptions = deprecate(function(options) {
                              this.requestCert = options.requestCert === true;
                              this.rejectUnauthorized = options.rejectUnauthorized !== false;
                            
                              if (options.pfx) this.pfx = options.pfx;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 3 days to fix
                            current/lib/_tls_wrap.js on lines 1369..1408

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 645.

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

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

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ 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, listener) {
                              if (!(this instanceof Server))
                                return new Server(options, listener);
                            
                              if (typeof options === 'function') {
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 3 days to fix
                            current/lib/_tls_wrap.js on lines 1155..1218

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 567.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype.renegotiate = function(options, callback) {
                              if (options === null || typeof options !== 'object')
                                throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
                              if (callback !== undefined && typeof callback !== 'function')
                                throw new ERR_INVALID_CALLBACK(callback);
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 2 days to fix
                            current/lib/_tls_wrap.js on lines 815..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 369.

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

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

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

                            See codeclimate-duplication's documentation for more 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 requestOCSP(socket, info) {
                              if (!info.OCSPRequest || !socket.server)
                                return requestOCSPDone(socket);
                            
                              let ctx = socket._handle.sni_context;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 219..266

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 327.

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

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

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ 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

                            TLSSocket.prototype._wrapHandle = function(wrap) {
                              let handle;
                            
                              if (wrap)
                                handle = wrap._handle;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 577..610

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 298.

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

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

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

                            See codeclimate-duplication's documentation for more 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 tlsConnectionListener(rawSocket) {
                              debug('net.Server.on(connection): new TLSSocket');
                              const socket = new TLSSocket(rawSocket, {
                                secureContext: this._sharedCreds,
                                isServer: true,
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 1063..1088

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 274.

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

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

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ 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 loadSession(hello) {
                              debug('server onclienthello',
                                    'sessionid.len', hello.sessionId.length,
                                    'ticket?', hello.tlsTicket
                              );
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 153..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 251.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            tls_wrap.TLSWrap.prototype.close = function close(cb) {
                              let ssl;
                              if (this[owner_symbol]) {
                                ssl = this[owner_symbol].ssl;
                                this[owner_symbol].ssl = null;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 545..571

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 242.

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

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

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ 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 onhandshakestart(now) {
                              debug('server onhandshakestart');
                            
                              const { lastHandshakeTime } = this;
                              assert(now >= lastHandshakeTime,
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 106..135

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 204.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype._finishInit = function() {
                              // Guard against getting onhandshakedone() after .destroy().
                              // * 1.2: If destroy() during onocspresponse(), then write of next handshake
                              // record fails, the handshake done info callbacks does not occur, and the
                              // socket closes.
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 906..933

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 200.

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

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

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

                            See codeclimate-duplication's documentation for more 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 onnewsession(sessionId, session) {
                              debug('onnewsession');
                              const owner = this[owner_symbol];
                            
                              // TODO(@sam-github) no server to emit the event on, but handshake won't
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 288..319

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 199.

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

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

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

                            See codeclimate-duplication's documentation for more 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 onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
                              const owner = this[owner_symbol];
                              const ret = owner[kPskCallback](hint);
                              if (ret == null)
                                return undefined;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 day to fix
                            current/lib/_tls_wrap.js on lines 353..381

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 199.

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

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

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

                            See codeclimate-duplication's documentation for more 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 loadSNI(info) {
                              const owner = this[owner_symbol];
                              const servername = info.servername;
                              if (!servername || !owner._SNICallback)
                                return requestOCSP(owner, info);
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 7 hrs to fix
                            current/lib/_tls_wrap.js on lines 192..216

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 186.

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

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

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

                            See codeclimate-duplication's documentation for more 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 onerror(err) {
                              const owner = this[owner_symbol];
                              debug('%s onerror %s had? %j',
                                    owner._tlsOptions.isServer ? 'server' : 'client', err,
                                    owner._hadError);
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 6 hrs to fix
                            current/lib/_tls_wrap.js on lines 393..418

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 171.

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

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

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

                            See codeclimate-duplication's documentation for more 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 normalizeConnectArgs(listArgs) {
                              const args = net._normalizeArgs(listArgs);
                              const options = args[0];
                              const cb = args[1];
                            
                            
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 6 hrs to fix
                            current/lib/_tls_wrap.js on lines 1464..1481

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 170.

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

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

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

                            See codeclimate-duplication's documentation for more 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 onPskServerCallback(identity, maxPskLen) {
                              const owner = this[owner_symbol];
                              const ret = owner[kPskCallback](owner, identity);
                              if (ret == null)
                                return undefined;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 6 hrs to fix
                            current/lib/_tls_wrap.js on lines 321..351

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 157.

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

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

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

                            See codeclimate-duplication's documentation for more 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 onServerSocketSecure() {
                              if (this._requestCert) {
                                const verifyError = this._handle.verifyError();
                                if (verifyError) {
                                  this.authorizationError = verifyError.code;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 6 hrs to fix
                            current/lib/_tls_wrap.js on lines 1018..1036

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 156.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype._start = function() {
                              debug('%s _start',
                                    this._tlsOptions.isServer ? 'server' : 'client',
                                    'handle?', !!this._handle,
                                    'connecting?', this.connecting,
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 6 hrs to fix
                            current/lib/_tls_wrap.js on lines 935..954

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 155.

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

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

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ 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 initRead(tlsSocket, socket) {
                              debug('%s initRead',
                                    tlsSocket._tlsOptions.isServer ? 'server' : 'client',
                                    'handle?', !!tlsSocket._handle,
                                    'buffered?', !!socket && socket.readableLength
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 5 hrs to fix
                            current/lib/_tls_wrap.js on lines 422..440

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 145.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype._destroySSL = function _destroySSL() {
                              if (!this.ssl) return;
                              this.ssl.destroySSL();
                              if (this.ssl._secureContext.singleUse) {
                                this.ssl._secureContext.context.close();
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 5 hrs to fix
                            current/lib/_tls_wrap.js on lines 635..645

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 142.

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

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

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

                            See codeclimate-duplication's documentation for more 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 onConnectEnd() {
                              // NOTE: This logic is shared with _http_client.js
                              if (!this._hadError) {
                                const options = this[kConnectOptions];
                                this._hadError = true;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 5 hrs to fix
                            current/lib/_tls_wrap.js on lines 1539..1553

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 137.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            Server.prototype.addContext = function(servername, context) {
                              if (!servername) {
                                throw new ERR_TLS_REQUIRED_SERVER_NAME();
                              }
                            
                            
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 3 hrs to fix
                            current/lib/_tls_wrap.js on lines 1411..1421

                            Duplicated Code

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

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

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

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

                              if (!verifyError && !this.isSessionReused()) {
                                const hostname = options.servername ||
                                               options.host ||
                                               (options.socket && options.socket._host) ||
                                               'localhost';
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 3 hrs to fix
                            current/lib/_tls_wrap.js on lines 1501..1508

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 99.

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

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

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

                            See codeclimate-duplication's documentation for more 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 SNICallback(servername, callback) {
                              const contexts = this.server._contexts;
                            
                              for (const elem of contexts) {
                                if (elem[0].test(servername)) {
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 2 hrs to fix
                            current/lib/_tls_wrap.js on lines 1436..1447

                            Duplicated Code

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

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

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

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

                            TLSSocket.prototype.exportKeyingMaterial = function(length, label, context) {
                              validateUint32(length, 'length', true);
                              validateString(label, 'label');
                              if (context !== undefined)
                                validateBuffer(context, 'context');
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 2 hrs to fix
                            current/lib/_tls_wrap.js on lines 865..875

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 89.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            function onSocketClose(err) {
                              // Closed because of error - no need to emit it twice
                              if (err)
                                return;
                            
                            
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 2 hrs to fix
                            current/lib/_tls_wrap.js on lines 1050..1061

                            Duplicated Code

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

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

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

                            function onhandshakedone() {
                              debug('server onhandshakedone');
                            
                              const owner = this[owner_symbol];
                              assert(owner._tlsOptions.isServer);
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 2 hrs to fix
                            current/lib/_tls_wrap.js on lines 137..150

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 78.

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

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

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

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

                            Refactorings

                            Further Reading

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

                              if (ekeyinfo.type === 'DH' && ekeyinfo.size < options.minDHSize) {
                                const err = new ERR_TLS_DH_PARAM_SIZE(ekeyinfo.size);
                                debug('client emit:', err);
                                this.emit('error', err);
                                this.destroy();
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 2 hrs to fix
                            current/lib/_tls_wrap.js on lines 1489..1495

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 77.

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

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

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

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

                            Refactorings

                            Further Reading

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

                              if (enableTrace == null) {
                                enableTrace = traceTls;
                            
                                if (enableTrace && !tlsTracingWarned) {
                                  tlsTracingWarned = true;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 2 hrs to fix
                            current/lib/_tls_wrap.js on lines 450..461

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 76.

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

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

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

                            See codeclimate-duplication's documentation for more 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 (options.servername) {
                                if (!ipServernameWarned && net.isIP(options.servername)) {
                                  process.emitWarning(
                                    'Setting the TLS ServerName to an IP address is not permitted by ' +
                                    'RFC 6066. This will be ignored in a future version.',
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 2 hrs to fix
                            current/lib/_tls_wrap.js on lines 1617..1628

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 75.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            const {
                              ERR_INVALID_ARG_TYPE,
                              ERR_INVALID_ARG_VALUE,
                              ERR_INVALID_CALLBACK,
                              ERR_MULTIPLE_CALLBACK,
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 6 other locations - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 59..73
                            current/lib/internal/error_serdes.js on lines 4..18
                            current/lib/internal/url.js on lines 3..17
                            current/lib/perf_hooks.js on lines 31..46
                            lts/lib/internal/url.js on lines 3..17
                            lts/lib/perf_hooks.js on lines 31..46

                            Duplicated Code

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

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

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

                            function onSocketTLSError(err) {
                              if (!this._controlReleased && !this[kErrorEmitted]) {
                                this[kErrorEmitted] = true;
                                debug('server emit tlsClientError:', err);
                                this._tlsOptions.server.emit('tlsClientError', err, this);
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 1038..1044

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 72.

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

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

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

                            See codeclimate-duplication's documentation for more 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 defineHandleReading(socket, handle) {
                              ObjectDefineProperty(handle, 'reading', {
                                get: () => {
                                  return socket[kRes].reading;
                                },
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 614..623

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 70.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            function onnewsessionclient(sessionId, session) {
                              debug('client emit session');
                              const owner = this[owner_symbol];
                              if (owner[kIsVerified]) {
                                owner.emit('session', session);
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 278..286

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 66.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype.setServername = function(name) {
                              validateString(name, 'name');
                            
                              if (this._tlsOptions.isServer) {
                                throw new ERR_TLS_SNI_FROM_SERVER();
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 956..964

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 65.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype.getCertificate = function() {
                              if (this._handle) {
                                // It's not a peer cert, but the formatting is identical.
                                return common.translatePeerCertificate(
                                  this._handle.getCertificate()) || {};
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 981..989

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 65.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            function requestOCSPDone(socket) {
                              debug('server certcb done');
                              try {
                                socket._handle.certCbDone();
                              } catch (e) {
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 268..276

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 63.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype.getPeerCertificate = function(detailed) {
                              if (this._handle) {
                                return common.translatePeerCertificate(
                                  this._handle.getPeerCertificate(detailed)) || {};
                              }
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 972..979

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 63.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype.setSession = function(session) {
                              if (typeof session === 'string')
                                session = Buffer.from(session, 'latin1');
                              this._handle.setSession(session);
                            };
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 966..970

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 62.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype._releaseControl = function() {
                              if (this._controlReleased)
                                return false;
                              this._controlReleased = true;
                              this.removeListener('error', this._tlsError);
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 898..904

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 61.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            function makeMethodProxy(name) {
                              return function methodProxy(...args) {
                                if (this._parent[name])
                                  return this._parent[name].apply(this._parent, args);
                              };
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 534..539

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 60.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            function makeSocketMethodProxy(name) {
                              return function socketMethodProxy(...args) {
                                if (this._handle)
                                  return this._handle[name].apply(this._handle, args);
                                return null;
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 992..998

                            Duplicated Code

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

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

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

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

                              if (!options.socket) {
                                // If user provided the socket, it's their responsibility to manage its
                                // connectivity. If we created one internally, we connect it.
                                if (options.timeout) {
                                  tlssock.setTimeout(options.timeout);
                            Severity: Major
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 1 hr to fix
                            current/lib/_tls_wrap.js on lines 1602..1610

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 58.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype._emitTLSError = function(err) {
                              const e = this._tlsError(err);
                              if (e)
                                this.emit('error', e);
                            };
                            Severity: Minor
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 50 mins to fix
                            current/lib/_tls_wrap.js on lines 885..889

                            Duplicated Code

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

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

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

                            [
                              'getCipher',
                              'getSharedSigalgs',
                              'getEphemeralKeyInfo',
                              'getFinished',
                            Severity: Minor
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 40 mins to fix
                            current/lib/_tls_wrap.js on lines 1000..1013

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 49.

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

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

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

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

                            Refactorings

                            Further Reading

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

                            TLSSocket.prototype._tlsError = function(err) {
                              this.emit('_tlsError', err);
                              if (this._controlReleased)
                                return err;
                              return null;
                            Severity: Minor
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 35 mins to fix
                            current/lib/_tls_wrap.js on lines 891..896

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 47.

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

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

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

                            See codeclimate-duplication's documentation for more 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._setServerData = function(data) {
                              this.setTicketKeys(Buffer.from(data.ticketKeys, 'hex'));
                            };
                            Severity: Minor
                            Found in lts/lib/_tls_wrap.js and 1 other location - About 30 mins to fix
                            current/lib/_tls_wrap.js on lines 1354..1356

                            Duplicated Code

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

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

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