mbroadst/rethunk

View on GitHub
lib/connection.js

Summary

Maintainability
F
5 days
Test Coverage

File connection.js has 582 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
var net = require('net'),
    tls = require('tls'),
    Promise = require('bluebird'),
    events = require('events'),
Severity: Major
Found in lib/connection.js - About 1 day to fix

    Function Connection has 140 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Connection(r, options, resolve, reject) {
      var self = this;
      this.r = r;
      this.state = 0; // Track the progress of the handshake. -1 will be used for an error state.
    
    
    Severity: Major
    Found in lib/connection.js - About 5 hrs to fix

      Function _handleSuccessPartial has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      Connection.prototype._handleSuccessPartial = function(response, token) {
        // We save the current resolve function because we are going to call cursor._fetch
        // before resuming the user's yield
        var currentResolve = this.metadata[token].resolve;
        var currentReject = this.metadata[token].reject;
      Severity: Minor
      Found in lib/connection.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 Connection has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      function Connection(r, options, resolve, reject) {
        var self = this;
        this.r = r;
        this.state = 0; // Track the progress of the handshake. -1 will be used for an error state.
      
      
      Severity: Minor
      Found in lib/connection.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 _handleSuccessPartial has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Connection.prototype._handleSuccessPartial = function(response, token) {
        // We save the current resolve function because we are going to call cursor._fetch
        // before resuming the user's yield
        var currentResolve = this.metadata[token].resolve;
        var currentReject = this.metadata[token].reject;
      Severity: Minor
      Found in lib/connection.js - About 1 hr to fix

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

        Connection.prototype._handleSuccessSequence = function(response, token) {
          this.emit('release');
        
          var currentResolve, currentReject;
          if (typeof this.metadata[token].resolve === 'function') {
        Severity: Minor
        Found in lib/connection.js - About 1 hr to fix

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

          Connection.prototype._computeSaltedPassword = function(messageServer, reject) {
            var self = this;
            var authentication = helper.splitCommaEqual(messageServer.authentication);
          
            var randomNonce = authentication.r;
          Severity: Minor
          Found in lib/connection.js - About 1 hr to fix

            Function _compareDigest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Connection.prototype._compareDigest = function(messageServer, resolve, reject) {
              var self = this;
              var firstEquals = messageServer.authentication.indexOf('=');
              var serverSignatureValue = messageServer.authentication.slice(firstEquals + 1);
            
            
            Severity: Minor
            Found in lib/connection.js - About 1 hr to fix

              Function _send has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Connection.prototype._send = function(query, token, resolve, reject, originalQuery, options, end) {
                //console.log('Connection.prototype._send: '+token);
                //console.log(JSON.stringify(query, null, 2));
              
                var self = this;
              Severity: Minor
              Found in lib/connection.js - About 1 hr to fix

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

                Connection.prototype._send = function(query, token, resolve, reject, originalQuery, options, end) {
                  //console.log('Connection.prototype._send: '+token);
                  //console.log(JSON.stringify(query, null, 2));
                
                  var self = this;
                Severity: Minor
                Found in lib/connection.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 _send has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                Connection.prototype._send = function(query, token, resolve, reject, originalQuery, options, end) {
                Severity: Major
                Found in lib/connection.js - About 50 mins to fix

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

                  Connection.prototype._handleSuccessSequence = function(response, token) {
                    this.emit('release');
                  
                    var currentResolve, currentReject;
                    if (typeof this.metadata[token].resolve === 'function') {
                  Severity: Minor
                  Found in lib/connection.js - About 45 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

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

                  Connection.prototype._handleSuccessAtom = function(response, token) {
                    this.emit('release');
                  
                    var datum = helper.makeAtom(response, this.metadata[token].options);
                    var cursor, stream;
                  Severity: Minor
                  Found in lib/connection.js - About 45 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

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

                  Connection.prototype._handleRuntimeError = function(response, token) {
                    var errorValue = helper.makeAtom(response);
                    var error;
                  
                    // We don't want to release a connection if we just pinged it.
                  Severity: Minor
                  Found in lib/connection.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 close has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Connection.prototype.close = function(options, callback) {
                    if (typeof options === 'function') {
                      callback = options;
                      options = {};
                    }
                  Severity: Minor
                  Found in lib/connection.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

                    if ((this.metadata[token].options.cursor === true) ||
                        ((this.metadata[token].options.cursor === undefined) && (this.r._options.cursor === true))) {
                      currentResolve(cursor, response);
                  
                      // We need to keep the options in the else statement, so we clean it inside the if/else blocks
                  Severity: Major
                  Found in lib/connection.js and 1 other location - About 1 hr to fix
                  lib/connection.js on lines 476..493

                  Duplicated Code

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

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

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

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

                    if ((this.metadata[token].options.cursor === true) ||
                        ((this.metadata[token].options.cursor === undefined) && (this.r._options.cursor === true))) {
                      currentResolve(cursor, response);
                    } else if ((this.metadata[token].options.stream === true || this.r._options.stream === true)) {
                      var stream = new ReadableStream({}, cursor);
                  Severity: Major
                  Found in lib/connection.js and 1 other location - About 1 hr to fix
                  lib/connection.js on lines 518..538

                  Duplicated Code

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

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

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

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

                    } else if (typeof this.metadata[token].endResolve === 'function') {
                      currentResolve = this.metadata[token].endResolve;
                      currentReject = this.metadata[token].endReject;
                      this.metadata[token].removeEndCallbacks();
                    }
                  Severity: Major
                  Found in lib/connection.js and 1 other location - About 1 hr to fix
                  lib/connection.js on lines 502..510

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 60.

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

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

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

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

                  Refactorings

                  Further Reading

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

                    if (typeof this.metadata[token].resolve === 'function') {
                      currentResolve = this.metadata[token].resolve;
                      currentReject = this.metadata[token].reject;
                      this.metadata[token].removeCallbacks();
                    } else if (typeof this.metadata[token].endResolve === 'function') {
                  Severity: Major
                  Found in lib/connection.js and 1 other location - About 1 hr to fix
                  lib/connection.js on lines 506..510

                  Duplicated Code

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

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

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

                      }, function(err) {
                        // The TCP connection is open, but the ReQL connection wasn't established.
                        // We can just abort the whole thing
                        self.open = false;
                        reject(new errors.ReqlDriverError('Failed to perform handshake with ' + self.host + ':' + self.port));
                  Severity: Major
                  Found in lib/connection.js and 2 other locations - About 1 hr to fix
                  lib/connection.js on lines 138..143
                  lib/connection.js on lines 263..268

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 56.

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

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

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

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

                  Refactorings

                  Further Reading

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

                      }, function(err) {
                        // The TCP connection is open, but the ReQL connection wasn't established.
                        // We can just abort the whole thing
                        self.open = false;
                        reject(new errors.ReqlDriverError('Failed to perform handshake with ' + self.host + ':' + self.port));
                  Severity: Major
                  Found in lib/connection.js and 2 other locations - About 1 hr to fix
                  lib/connection.js on lines 247..252
                  lib/connection.js on lines 263..268

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 56.

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

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

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

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

                  Refactorings

                  Further Reading

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

                        }, function(err) {
                          // The TCP connection is open, but the ReQL connection wasn't established.
                          // We can just abort the whole thing
                          self.open = false;
                          reject(new errors.ReqlDriverError('Failed to perform handshake with ' + self.host + ':' + self.port));
                  Severity: Major
                  Found in lib/connection.js and 2 other locations - About 1 hr to fix
                  lib/connection.js on lines 138..143
                  lib/connection.js on lines 247..252

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 56.

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

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

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

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

                  Refactorings

                  Further Reading

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

                  Connection.prototype.use = function(db) {
                    if (typeof db !== 'string') throw new errors.ReqlDriverError('First argument of `use` must be a string');
                    this.db = db;
                  };
                  Severity: Major
                  Found in lib/connection.js and 2 other locations - About 55 mins to fix
                  lib/index.js on lines 66..69
                  lib/index.js on lines 71..74

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 53.

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

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

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

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

                  Refactorings

                  Further Reading

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

                      if (typeof metadata[key].reject === 'function') {
                        metadata[key].reject(new errors.ReqlServerError(
                            'The connection was closed before the query could be completed.',
                            metadata[key].query));
                      }
                  Severity: Minor
                  Found in lib/connection.js and 1 other location - About 55 mins to fix
                  lib/connection.js on lines 729..733

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 53.

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

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

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

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

                  Refactorings

                  Further Reading

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

                      if (typeof metadata[key].endReject === 'function') {
                        metadata[key].endReject(new errors.ReqlServerError(
                            'The connection was closed before the query could be completed.',
                            metadata[key].query));
                      }
                  Severity: Minor
                  Found in lib/connection.js and 1 other location - About 55 mins to fix
                  lib/connection.js on lines 723..727

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 53.

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

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

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

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

                  Refactorings

                  Further Reading

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

                    if (!!this.metadata[token].cursor) {  // This is a continue query
                      return currentResolve({ done: true, response: response });
                    }
                  Severity: Minor
                  Found in lib/connection.js and 1 other location - About 30 mins to fix
                  lib/connection.js on lines 444..446

                  Duplicated Code

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

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

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

                  Tuning

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

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

                    if (!!this.metadata[token].cursor) {  // This is a continue query
                      return currentResolve({ done: false, response: response });
                    }
                  Severity: Minor
                  Found in lib/connection.js and 1 other location - About 30 mins to fix
                  lib/connection.js on lines 512..514

                  Duplicated Code

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

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

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

                  Tuning

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