mbroadst/rethunk

View on GitHub

Showing 396 of 396 total issues

Function generateBacktrace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function generateBacktrace(term, index, father, frames, options) {
  var result = { str: '', car: '' };
  var backtrace, underline;

  // frames = null -> do not underline
Severity: Minor
Found in lib/error.js - About 35 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 indexCreate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

Term.prototype.indexCreate = function(name, fn, options) {
  if (this._fastArityRange(arguments.length, 1, 3) === false) {
    var _len = arguments.length; var _args = new Array(_len);
    for (var _i = 0; _i < _len; _i++) {_args[_i] = arguments[_i];}
    this._arityRange(_args, 1, 3, 'indexCreate', this);
Severity: Minor
Found in lib/term.js - About 35 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 union has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

Term.prototype.union = function() {
  var _len = arguments.length;var _args = new Array(_len); for(var _i = 0; _i < _len; _i++) {_args[_i] = arguments[_i];}

  var term = new Term(this._r);
  term._query.push(termTypes.UNION);
Severity: Minor
Found in lib/term.js - About 35 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 Term has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function Term(r, value, error) {
  var self = this;
  var term = function(field) {
    if (Term.prototype._fastArity(arguments.length, 1) === false) {
      var _len = arguments.length; var _args = new Array(_len);
Severity: Minor
Found in lib/term.js - About 35 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 group has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

Term.prototype._fillArgs = function(args) {
  var foundError = false;
  var internalArgs = [];

  var _len = args.length;
Severity: Minor
Found in lib/term.js - About 35 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 drain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

Pool.prototype.drain = function() {
  var self = this;
  self._draining = true;
  self._log('Draining the pool connected to ' + this.getAddress());
  self.emit('draining');
Severity: Minor
Found in lib/pool.js - About 35 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

        ResponseType: {
            SUCCESS_ATOM: 1,
            SUCCESS_SEQUENCE: 2,
            SUCCESS_PARTIAL: 3,
            WAIT_COMPLETE: 4,
Severity: Minor
Found in lib/protodef.js and 1 other location - About 35 mins to fix
lib/protodef.js on lines 54..63

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 46.

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

        ErrorType: {
            INTERNAL: 1000000,
            RESOURCE_LIMIT: 2000000,
            QUERY_LOGIC: 3000000,
            NON_EXISTENCE: 3100000,
Severity: Minor
Found in lib/protodef.js and 1 other location - About 35 mins to fix
lib/protodef.js on lines 43..52

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 46.

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

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

    Avoid too many return statements within this function.
    Open

        return term;
    Severity: Major
    Found in lib/term.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

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

        Avoid too many return statements within this function.
        Open

          return self;
        Severity: Major
        Found in lib/term.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return false;
          Severity: Major
          Found in lib/helper.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return new Promise(function(resolve, reject) {
                self._pendingPromises.push({resolve: resolve, reject: reject});
              }).nodeify(callback);
            Severity: Major
            Found in lib/cursor.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

                    return term;
                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, null, expression);
                  Severity: Major
                  Found in lib/term.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return obj;
                    Severity: Major
                    Found in lib/helper.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
                        Severity
                        Category
                        Status
                        Source
                        Language