mbroadst/rethunk

View on GitHub

Showing 144 of 396 total issues

Function _each has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

Cursor.prototype._each = function(callback, onFinish) {
  if (this._closed === true) {
    return callback(new errors.ReqlDriverError('You cannot retrieve data from a cursor that is closed'));
  }

Severity: Minor
Found in lib/cursor.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 TABLE has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  TABLE: function(term, index, father, frames, options) {
    var result = { str: '', car: '' };
    var backtrace, underline, currentFrame;
    if ((term.length === 1) || (term[1].length === 0) || (term[1][0][0] !== termTypes.DB)) {
      underline = Array.isArray(frames) && (frames.length === 0);
Severity: Minor
Found in lib/error.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 _insert has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

TransformStream.prototype._insert = function() {
  var self = this;
  self._inserting = true;

  var cache = self._cache;
Severity: Major
Found in lib/transform_stream.js - About 2 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 DATUM has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      DATUM: function(term, index, father, frames, options, optarg) {
        optarg = optarg || false;
    
        var underline = Array.isArray(frames) && (frames.length === 0);
        var currentFrame, backtrace;
    Severity: Major
    Found in lib/error.js - About 2 hrs to fix

      Function run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      Term.prototype.run = function(connection, options, callback) {
        if (!!this._error) {
          return Promise.reject(new errors.ReqlRuntimeError(this._error, this._query, { b: this._frames }));
        }
      
      
      Severity: Minor
      Found in lib/term.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 FUNCALL has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        FUNCALL: function(term, index, father, frames, options) {
          // The syntax is args[1].do(args[0])
          var result = { str: '', car: '' };
          var backtrace, underline, currentFrame;
          underline = Array.isArray(frames) && (frames.length === 0);
      Severity: Minor
      Found in lib/error.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

      Consider simplifying this complex logical expression.
      Open

              if ((key === 'readMode') || (key === 'durability') || (key === 'db') ||
                  (key === 'noreply') || (key === 'arrayLimit') || (key === 'profile') ||
                  (key === 'minBatchRows') || (key === 'maxBatchRows') || (key === 'maxBatchBytes') ||
                  (key === 'maxBatchSeconds') || (key === 'firstBatchScaledownFactor')) {
                sendOptions = true;
      Severity: Critical
      Found in lib/term.js - About 2 hrs to fix

        Function initPool has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        PoolMaster.prototype.initPool = function(pool) {
          var self = this;
        
          pool.on('size-diff', function(diff) {
            self._numConnections += diff;
        Severity: Major
        Found in lib/pool_master.js - About 2 hrs to fix

          Function _eachAsyncInternal has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          Cursor.prototype._eachAsyncInternal = function(callback, finalResolve, finalReject) {
            if (this._closed === true) {
              finalReject(new errors.ReqlDriverError('You cannot retrieve data from a cursor that is closed'));
              return;
            }
          Severity: Minor
          Found in lib/cursor.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 convertPseudoType has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function convertPseudoType(obj, options) {
            if (Array.isArray(obj)) return convertPseudoTypeArray(obj, options);
            if (isPlainObject(obj)) {
              if ((options.timeFormat !== 'raw') && (obj.$reql_type$ === 'TIME')) {
                return new Date(obj.epoch_time * 1000);
          Severity: Minor
          Found in lib/helper.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 putConnection has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          Pool.prototype.putConnection = function(connection) {
            var self = this;
            if (connection.end === false) {
              // Temporary attempt to fix #192 - this should not happen.
              return;
          Severity: Minor
          Found in lib/pool.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 PoolMaster has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function PoolMaster(r, options) {
            var self = this;
          
            options = options || {};
            var lineLength = options.buffer || 50;
          Severity: Major
          Found in lib/pool_master.js - About 2 hrs to fix

            File protodef.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            "use strict";
            // DO NOT EDIT
            // Autogenerated by convert_protofile
            
            module.exports = {
            Severity: Minor
            Found in lib/protodef.js - About 2 hrs to fix

              Function handleAllServersResponse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              PoolMaster.prototype.handleAllServersResponse = function(servers) {
                var self = this;
                if (self._draining === true) return;
              
                // Fill all the known server from RethinkDB
              Severity: Major
              Found in lib/pool_master.js - About 2 hrs to fix

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

                  FUNC: function(term, index, father, frames, options) {
                    var result = { str: '', car: '' };
                    var backtrace, underline, currentFrame;
                
                    underline = Array.isArray(frames) && (frames.length === 0);
                Severity: Minor
                Found in lib/error.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 _run has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Term.prototype._run = function(connection, options) {
                  var self = this;
                  return new Promise(function(resolve, reject) {
                    var token = connection._getToken();
                
                
                Severity: Major
                Found in lib/term.js - About 2 hrs to fix

                  Function putConnection has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Pool.prototype.putConnection = function(connection) {
                    var self = this;
                    if (connection.end === false) {
                      // Temporary attempt to fix #192 - this should not happen.
                      return;
                  Severity: Minor
                  Found in lib/pool.js - About 1 hr to fix

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

                    function Pool(r, options) {
                      this._r = r;
                    
                      if (!helper.isPlainObject(options)) options = {};
                      this.options = {};
                    Severity: Minor
                    Found in lib/pool.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language