Yoobic/loopback-connector-rethinkdbdash

View on GitHub

Showing 13 of 24 total issues

File rethink.js has 544 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* jshint undef: true, unused: true, latedef: nofunc*/
/*eslint no-use-before-define:0, no-extra-parens:0, consistent-this:0*/
'use strict';

var r;
Severity: Major
Found in lib/rethink.js - About 1 day to fix

    Function autoupdate has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    RethinkDB.prototype.autoupdate = function(models, done) {
        debug('autoupdate');
        var _this = this;
    
        if((!done) && ('function' === typeof models)) {
    Severity: Major
    Found in lib/rethink.js - About 2 hrs to fix

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

      RethinkDB.prototype.autoupdate = function(models, done) {
          debug('autoupdate');
          var _this = this;
      
          if((!done) && ('function' === typeof models)) {
      Severity: Minor
      Found in lib/rethink.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 initializeDataSource has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.initialize = function initializeDataSource(dataSource, callback) {
          debug('initialize');
      
          var s = dataSource.settings;
      
      
      Severity: Minor
      Found in lib/rethink.js - About 1 hr to fix

        Function createAllPromise has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var createAllPromise = function(model, filter) {
            var _this = this;
        
            if(!filter) {
                filter = {};
        Severity: Minor
        Found in lib/rethink.js - About 1 hr to fix

          Function isActual has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          RethinkDB.prototype.isActual = function(cb) {
              debug('isActual');
              var _this = this;
          
              r.db(_this.database).tableList().run()
          Severity: Minor
          Found in lib/rethink.js - About 1 hr to fix

            Function save has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            RethinkDB.prototype.save = function(model, data, callback, strict, returnObject) {
                debug('save');
                var _this = this;
            
                if(strict === undefined) {
            Severity: Minor
            Found in lib/rethink.js - About 1 hr to fix

              Function buildFilter has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function buildFilter(where) {
                  var filter = [];
              
                  Object.keys(where).forEach(function(k) {
              
              
              Severity: Minor
              Found in lib/rethink.js - About 1 hr to fix

                Function createIndices has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function createIndices(model) {
                        var properties = _this._models[model].properties;
                        var settings = _this._models[model].settings;
                        var indexCollection = _.extend({}, properties, settings);
                
                
                Severity: Minor
                Found in lib/rethink.js - About 1 hr to fix

                  Function promises has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              var promises = Object.keys(_this._models).map(function(model) {
                                  if(!actual) {
                                      cb(null, false);
                                      return;
                                  }
                  Severity: Minor
                  Found in lib/rethink.js - About 1 hr to fix

                    Function createAllPromise has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var createAllPromise = function(model, filter) {
                        var _this = this;
                    
                        if(!filter) {
                            filter = {};
                    Severity: Minor
                    Found in lib/rethink.js - About 55 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 initializeDataSource has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    exports.initialize = function initializeDataSource(dataSource, callback) {
                        debug('initialize');
                    
                        var s = dataSource.settings;
                    
                    
                    Severity: Minor
                    Found in lib/rethink.js - About 55 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 save has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    RethinkDB.prototype.save = function(model, data, callback, strict, returnObject) {
                    Severity: Minor
                    Found in lib/rethink.js - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language