jmdobry/waterline-rethinkdb

View on GitHub

Showing 17 of 25 total issues

File adapter.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

var _ = require('underscore'),
    async = require('async'),
    Connection = require('./connection'),
Severity: Minor
Found in lib/adapter.js - About 5 hrs to fix

    Function define has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    RethinkDBAdapter.prototype.define = function define(collectionName, definition, cb) {
    
        var collection = this.getDef(collectionName),
            _this = this,
            tableCreateOptions = {},
    Severity: Minor
    Found in lib/adapter.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 Connection has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Connection(options) {
    
        ///////////////////////
        // Private variables //
        ///////////////////////
    Severity: Major
    Found in lib/connection.js - About 3 hrs to fix

      Function update has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      RethinkDBAdapter.prototype.update = function update(collectionName, options, values, cb) {
      
          var collection = this.getDef(collectionName),
              _this = this;
      
      
      Severity: Major
      Found in lib/adapter.js - About 3 hrs to fix

        Function define has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        RethinkDBAdapter.prototype.define = function define(collectionName, definition, cb) {
        
            var collection = this.getDef(collectionName),
                _this = this,
                tableCreateOptions = {},
        Severity: Major
        Found in lib/adapter.js - About 2 hrs to fix

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

          function Connection(options) {
          
              ///////////////////////
              // Private variables //
              ///////////////////////
          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 find has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          RethinkDBAdapter.prototype.find = function find(collectionName, options, cb) {
          
              var collection = this.getDef(collectionName),
                  _this = this;
          
          
          Severity: Major
          Found in lib/adapter.js - About 2 hrs to fix

            Function exports has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function (grunt) {
            
                require('load-grunt-tasks')(grunt);
                require('time-grunt')(grunt);
            
            
            Severity: Minor
            Found in Gruntfile.js - About 1 hr to fix

              Function create has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              RethinkDBAdapter.prototype.create = function create(collectionName, values, cb) {
              
                  var queries = [],
                      collection = this.getDef(collectionName),
                      _this = this;
              Severity: Minor
              Found in lib/adapter.js - About 1 hr to fix

                Function RethinkDBAdapter has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function RethinkDBAdapter(options) {
                
                    ///////////////////////
                    // Private variables //
                    ///////////////////////
                Severity: Minor
                Found in lib/adapter.js - About 1 hr to fix

                  Function update has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  RethinkDBAdapter.prototype.update = function update(collectionName, options, values, cb) {
                  
                      var collection = this.getDef(collectionName),
                          _this = this;
                  
                  
                  Severity: Minor
                  Found in lib/adapter.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 create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  RethinkDBAdapter.prototype.create = function create(collectionName, values, cb) {
                  
                      var queries = [],
                          collection = this.getDef(collectionName),
                          _this = this;
                  Severity: Minor
                  Found in lib/adapter.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 _configure has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function _configure(options, strict) {
                          var errorPrefix = 'Connection.configure(options, strict): options';
                  
                          if (!_.isObject(options)) {
                              throw new Error(errorPrefix + ': must be an object!');
                  Severity: Minor
                  Found in lib/connection.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    if (result > 0) {
                                                        cb('Unique constraint failure!');
                                                    } else {
                                                        cb();
                                                    }
                    Severity: Major
                    Found in lib/adapter.js - About 45 mins to fix

                      Function find has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      RethinkDBAdapter.prototype.find = function find(collectionName, options, cb) {
                      
                          var collection = this.getDef(collectionName),
                              _this = this;
                      
                      
                      Severity: Minor
                      Found in lib/adapter.js - About 45 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

                      Avoid deeply nested control flow statements.
                      Open

                                          if (definition[key][k].autoIncrement) {
                                              delete definition[key][k].autoIncrement;
                                          }
                      Severity: Major
                      Found in lib/adapter.js - About 45 mins to fix

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

                        RethinkDBAdapter.prototype.count = function count(collectionName, options, cb) {
                        
                            var collection = this.getDef(collectionName);
                        
                            options = options || {};
                        Severity: Minor
                        Found in lib/adapter.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

                        Severity
                        Category
                        Status
                        Source
                        Language