mbroadst/rethunk

View on GitHub

Showing 144 of 396 total issues

Function _each has 48 lines of code (exceeds 25 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 1 hr to fix

    Function MAKE_ARRAY has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      MAKE_ARRAY: 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 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 getCanonicalAddress has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    function getCanonicalAddress(addresses) {
      // We suppose that the addresses are all valid, and therefore use loose regex
      for (var i = 0; i < addresses.length; i++) {
        var addresse = addresses[i];
        if ((/^127(\.\d{1,3}){3}$/.test(addresse.host)) || (/0?:?0?:?0?:?0?:?0?:?0?:0?:1/.test(addresse.host))) {
    Severity: Minor
    Found in lib/helper.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 orderBy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    Term.prototype.orderBy = function() {
      var _len = arguments.length; var _args = new Array(_len);
      for (var _i = 0; _i < _len; _i++) {_args[_i] = arguments[_i];}
      this._arityRange(_args, 1, Infinity, 'orderBy', this);
    
    
    Severity: Minor
    Found in lib/term.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 ReqlCompileError has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    error.ReqlCompileError = function(message, query, frames) {
      error.ReqlBaseError.call(this, message);
      this.name = 'ReqlCompileError';
    
      if (!!query && !!frames) {
    Severity: Minor
    Found in lib/error.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 ReqlRuntimeError has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    error.ReqlRuntimeError = function(message, query, frames) {
      error.ReqlBaseError.call(this, message);
      this.name = 'ReqlRuntimeError';
    
      if (!!query && !!frames) {
    Severity: Minor
    Found in lib/error.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 _eachAsyncInternal has 47 lines of code (exceeds 25 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 1 hr to fix

      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 _next has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        Cursor.prototype._next = function(callback) {
          var self = this;
          if (self._closed === true) {
            return Promise.reject(new errors.ReqlDriverError('You cannot call `next` on a closed ' + self._type))
              .nodeify(callback);
        Severity: Minor
        Found in lib/cursor.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 generateNormalBacktrace has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

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

        function generateNormalBacktrace(term, index, father, frames, options) {
          var result = { str: '', car: '' };
          var backtrace, currentFrame, underline;
          underline = Array.isArray(frames) && (frames.length === 0);
          currentFrame = Array.isArray(frames) ? frames.shift() : null;
        Severity: Minor
        Found in lib/error.js - About 1 hr to fix

          Function _next has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          TransformStream.prototype._next = function(value, encoding, done) {
            var self = this;
            if ((this._writableState.lastBufferedRequest !== null) && (this._writableState.lastBufferedRequest.chunk !== value)) {
              // There's more data to buffer
              if (this._cache.length < this._highWaterMark) {
          Severity: Minor
          Found in lib/transform_stream.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                    } else if ((key !== 'timeFormat') && (key !== 'groupFormat') &&
                               (key !== 'binaryFormat') && (key !== 'cursor') &&
                               (key !== 'readable') && (key !== 'writable') &&
                               (key !== 'transform') && (key !== 'stream') &&
                               (key !== 'highWaterMark')) {
            Severity: Critical
            Found in lib/term.js - About 1 hr to fix

              Function _next has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              WritableStream.prototype._next = function(value, encoding, done) {
                var self = this;
                if ((this._writableState.lastBufferedRequest !== null) && (this._writableState.lastBufferedRequest.chunk !== value)) {
                  // There's more data to buffer
                  if (this._cache.length < this._highWaterMark) {
              Severity: Minor
              Found in lib/writable_stream.js - About 1 hr to fix

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

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

                  var nextCb = function() {
                    self._stackSize++;
                    self._next().then(function(row) {
                      if (self._stackSize <= MAX_CALL_STACK) {
                        if (callback.length <= 1) {
                Severity: Minor
                Found in lib/cursor.js - About 1 hr to fix

                  Function run has 39 lines of code (exceeds 25 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 1 hr to fix

                    Function FUNCALL has 38 lines of code (exceeds 25 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 1 hr to fix

                      Function FUNC has 37 lines of code (exceeds 25 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 1 hr to fix

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

                        function getCanonicalAddress(addresses) {
                          // We suppose that the addresses are all valid, and therefore use loose regex
                          for (var i = 0; i < addresses.length; i++) {
                            var addresse = addresses[i];
                            if ((/^127(\.\d{1,3}){3}$/.test(addresse.host)) || (/0?:?0?:?0?:?0?:?0?:?0?:0?:1/.test(addresse.host))) {
                        Severity: Minor
                        Found in lib/helper.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language