mbroadst/rethunk

View on GitHub

Showing 396 of 396 total issues

Avoid too many return statements within this function.
Open

        return new Term(self._r, expression, 'Cannot convert `NaN` to JSON');
Severity: Major
Found in lib/term.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return new Term(self._r, expression);
    Severity: Major
    Found in lib/term.js - About 30 mins to fix

      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

        pool.on('size-diff', function(diff) {
          self._numConnections += diff;
          self.emit('size', self._numConnections);
        });
      Severity: Minor
      Found in lib/pool_master.js and 1 other location - About 30 mins to fix
      lib/pool_master.js on lines 413..416

      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

        pool.on('available-size-diff', function(diff) {
          self._numAvailableConnections += diff;
          self.emit('available-size', self._numAvailableConnections);
        });
      Severity: Minor
      Found in lib/pool_master.js and 1 other location - About 30 mins to fix
      lib/pool_master.js on lines 409..412

      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

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

            if (result.errors > 0) {
              self._inserting = false;
              self.emit('error', new Error('Failed to insert some documents:' + JSON.stringify(result, null, 2)));
            }
            else {
      Severity: Minor
      Found in lib/transform_stream.js and 1 other location - About 30 mins to fix
      lib/writable_stream.js on lines 108..111

      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

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

            if (result.errors > 0) {
              self._inserting = false;
              self.emit('error', new Error('Failed to insert some documents:' + JSON.stringify(result, null, 2)));
            }
      Severity: Minor
      Found in lib/writable_stream.js and 1 other location - About 30 mins to fix
      lib/transform_stream.js on lines 137..145

      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

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

      function makeOptargs(term, index, father, frames, options, currentFrame) {
        var result = { str: '', car: '' };
        var backtrace, underline;
      
        if (helper.isPlainObject(term[2])) {
      Severity: Minor
      Found in lib/error.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 _arity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      Term.prototype._arity = function(args, num, method, term) {
        var foundArgs = false; var _len = args.length;
        for (var i = 0; i < _len; ++i) {
          if ((args[i] instanceof Term) && (args[i]._query[0] === termTypes.ARGS)) {
            foundArgs = true;
      Severity: Minor
      Found in lib/term.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 distinct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      Term.prototype.distinct = function(options) {
        var self = this;
        if (self._fastArityRange(arguments.length, 0, 1) === false) {
          var _len = arguments.length; var _args = new Array(_len);
          for (var _i = 0; _i < _len; _i++) {_args[_i] = arguments[_i];}
      Severity: Minor
      Found in lib/term.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 fetchServers has a Cognitive Complexity of 6 (exceeds 5 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: Minor
      Found in lib/pool_master.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 GET_FIELD has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

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

      Term.prototype.split = function(separator, max) {
        if (this._fastArityRange(arguments.length, 0, 2) === false) {
          var _len = arguments.length; var _args = new Array(_len);
          for (var _i = 0; _i < _len; _i++) {_args[_i] = arguments[_i];}
          this._arityRange(_args, 0, 2, 'split', this);
      Severity: Minor
      Found in lib/term.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

      Severity
      Category
      Status
      Source
      Language