mbroadst/rethunk

View on GitHub

Showing 144 of 396 total issues

File term.js has 2755 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
var Promise = require('bluebird');
var protodef = require('./protodef.js');
var termTypes = protodef.Term.TermType;

Severity: Major
Found in lib/term.js - About 1 wk to fix

    File error.js has 823 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    var helper = require('./helper.js'),
        protodef = require('./protodef.js'),
        protoErrorType = protodef.Response.ErrorType,
        termTypes = protodef.Term.TermType,
    Severity: Major
    Found in lib/error.js - About 1 day to fix

      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

        File index.js has 519 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        "use strict";
        var Promise = require('bluebird');
        
        var helper = require(__dirname + '/helper.js');
        var Connection = require(__dirname + '/connection.js');
        Severity: Major
        Found in lib/index.js - About 1 day to fix

          File pool_master.js has 462 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          "use strict";
          var util = require('util');
          var events = require('events');
          var Promise = require('bluebird');
          var Dequeue = require('double-ended-queue');
          Severity: Minor
          Found in lib/pool_master.js - About 7 hrs to fix

            Function DATUM has a Cognitive Complexity of 40 (exceeds 5 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: Minor
            Found in lib/error.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 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 handleAllServersResponse has a Cognitive Complexity of 31 (exceeds 5 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: Minor
              Found in lib/pool_master.js - About 4 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              File cursor.js has 353 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              "use strict";
              var Promise = require('bluebird'),
                  EventEmitter = require('events').EventEmitter,
                  errors = require('./error.js'),
                  helper = require('./helper.js');
              Severity: Minor
              Found in lib/cursor.js - About 4 hrs to fix

                Function hasImplicit has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                function hasImplicit(arg) {
                  if (Array.isArray(arg)) {
                    if (arg[0] === termTypes.IMPLICIT_VAR) return true;
                
                    if (Array.isArray(arg[1])) {
                Severity: Minor
                Found in lib/helper.js - About 4 hrs to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function fetchServers has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                PoolMaster.prototype.fetchServers = function(useSeeds) {
                  var self = this;
                  var query = self._r.db('rethinkdb').table('server_status')
                      .union([SEPARATOR])
                      .union(self._r.db('rethinkdb').table('server_status').changes());
                Severity: Major
                Found in lib/pool_master.js - About 4 hrs to fix

                  File pool.js has 327 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  "use strict";
                  var Promise = require('bluebird');
                  var Dequeue = require('double-ended-queue');
                  var helper = require('./helper.js');
                  var errors = require('./error.js');
                  Severity: Minor
                  Found in lib/pool.js - About 3 hrs to fix

                    Function _next has a Cognitive Complexity of 26 (exceeds 5 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 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

                    File discovery.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    var config = require(__dirname+'/../test/config.js');
                    var longConfig = require(__dirname+'/config.js');
                    
                    var assert = require('assert');
                    var util = require(__dirname+'/../test/util/common.js');
                    Severity: Minor
                    Found in long_test/discovery.js - About 3 hrs to fix

                      Function expr has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Term.prototype.expr = function(expression, nestingLevel) {
                        var self = this;
                        self._noPrefix(self, 'expr');
                        if (self._fastArityRange(arguments.length, 1, 2) === false) {
                          var _len = arguments.length; var _args = new Array(_len);
                      Severity: Minor
                      Found in lib/term.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 createConnection has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      Pool.prototype.createConnection = function() {
                        var self = this;
                        self._increaseNumConnections();
                        self._openingConnections++;
                      
                      
                      Severity: Major
                      Found in lib/pool.js - About 3 hrs to fix

                        Function _arityRange has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                        Open

                        Term.prototype._arityRange = function(args, min, max, method, term) {
                          var foundArgs = false, _len = args.length;
                          if (args.length < min) {
                            for (var i = 0; i < _len; ++i) {
                              if ((args[i] instanceof Term) && (args[i]._query[0] === termTypes.ARGS)) {
                        Severity: Minor
                        Found in lib/term.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 _next has a Cognitive Complexity of 22 (exceeds 5 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 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

                        Consider simplifying this complex logical expression.
                        Open

                              if ((key !== 'timeout')
                                && (key !==  'attempts')
                                && (key !==  'redirects')
                                && (key !==  'verify')
                                && (key !==  'resultFormat')
                        Severity: Critical
                        Found in lib/term.js - About 3 hrs to fix

                          Function expr has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Term.prototype.expr = function(expression, nestingLevel) {
                            var self = this;
                            self._noPrefix(self, 'expr');
                            if (self._fastArityRange(arguments.length, 1, 2) === false) {
                              var _len = arguments.length; var _args = new Array(_len);
                          Severity: Major
                          Found in lib/term.js - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language