jmdobry/reheat

View on GitHub

Showing 125 of 296 total issues

Function load has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function load(relations, options, cb) {
    var models = container.get('models');
    var Model = this.constructor;
    var newModels = {};
    var merge = {};
Severity: Major
Found in lib/model/prototype/load.js - About 4 hrs to fix

    Function sanitize has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        return Promise.resolve().then(function sanitize() {
          if (!utils.isArray(keys)) {
            throw new IllegalArgumentError(errorPrefix + 'keys: Must be a string or an array!', { actual: typeof keys, expected: 'string|array' });
          } else if (!utils.isString(index) && !utils.isObject(index)) {
            throw new IllegalArgumentError(errorPrefix + 'index: Must be a string or an object!', { actual: typeof index, expected: 'string|object' });
    Severity: Major
    Found in lib/collection/static/getAll.js - About 4 hrs to fix

      Function softDeleteTimestamps has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          softDeleteTimestamps: function (test) {
              test.expect(7);
      
              var instance = {
                  attributes: {
      Severity: Major
      Found in old_test/reheat/model/prototype/destroy.test.js - About 3 hrs to fix

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

        module.exports = function (container, Promise, utils, errors) {
          var errorPrefix = 'Collection.getAll(keys, index[, options][, cb]): ';
          var IllegalArgumentError = errors.IllegalArgumentError;
          var RuntimeError = errors.RuntimeError;
        
        
        Severity: Minor
        Found in lib/collection/static/getAll.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 destroy.test.js has 327 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*jshint loopfunc:true*/
        
        var SandboxedModule = require('sandboxed-module'),
            errors = require('../../../../../build/instrument/lib/support/errors'),
            Promise = require('bluebird'),
        Severity: Minor
        Found in old_test/reheat/model/prototype/destroy.test.js - About 3 hrs to fix

          Function exports has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function (Collection_save, utils, errors, Promise) {
          
            var protoProps = {
          
              /**
          Severity: Minor
          Found in lib/collection/prototype/index.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 exports has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (Promise, utils, errors, models) {
            /**
             * @doc method
             * @id Model.instance_methods:destroy
             * @name destroy
          Severity: Major
          Found in lib/model/prototype/destroy.js - About 3 hrs to fix

            Function softDelete has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                softDelete: function (test) {
                    test.expect(7);
            
                    var instance = {
                        attributes: {
            Severity: Major
            Found in old_test/reheat/model/prototype/destroy.test.js - About 3 hrs to fix

              Function setUp has 84 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  setUp: function (cb) {
                      connection = new Connection();
                      connection.run(r.dbList())
                          .then(function (dbList) {
                              if (utils.contains(dbList, 'test')) {
              Severity: Major
              Found in old_test/model/static/relations.test.js - About 3 hrs to fix

                Function setUp has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    setUp: function (cb) {
                        connection = new Connection();
                        connection.run(r.dbList())
                            .then(function (dbList) {
                                if (utils.contains(dbList, 'test')) {
                Severity: Major
                Found in old_test/model/static/filter.relations.test.js - About 3 hrs to fix

                  Function evaluateRelations has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function evaluateRelations() {
                      utils.forOwn(models, function (model, modelName) {
                        if ('hasOne' in model.relations && !utils.isObject(model.relations.hasOne)) {
                          throw new errors.IllegalArgumentError(errorPrefix + modelName + '.relations.hasOne: Must be an object!', { actual: typeof model.relations.hasOne, expected: 'object' });
                        } else if ('belongsTo' in model.relations && !utils.isObject(model.relations.belongsTo)) {
                  Severity: Major
                  Found in lib/index.js - About 3 hrs to fix

                    Function destroy has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function destroy(options, cb) {
                        var Model = this.constructor;
                        var tasks = [];
                        if (utils.isFunction(options)) {
                          cb = options;
                    Severity: Major
                    Found in lib/model/prototype/destroy.js - About 3 hrs to fix

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

                      module.exports = function (container, Promise, utils, errors) {
                        /**
                         * @doc method
                         * @id Model.static_methods:destroyOne
                         * @name destroyOne
                      Severity: Major
                      Found in lib/model/static/destroyOne.js - About 3 hrs to fix

                        Function destroyOne has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function destroyOne(primaryKey, options, cb) {
                            var models = container.get('models');
                            var query;
                            var Model = this;
                        
                        
                        Severity: Major
                        Found in lib/model/static/destroyOne.js - About 3 hrs to fix

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

                          /*jshint loopfunc:true*/
                          
                          var prototype = require('../../../../../build/instrument/lib/model/prototype'),
                              errors = require('../../../../../build/instrument/lib/support/errors'),
                              utils = require('../../../../../build/instrument/lib/support/utils'),
                          Severity: Minor
                          Found in old_test/reheat/model/prototype/index.test.js - About 2 hrs to fix

                            Function defineModel has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                defineModel: function (test) {
                                    test.expect(42);
                            
                                    for (var i = 0; i < support.TYPES_EXCEPT_STRING.length; i++) {
                                        test.throws(
                            Severity: Major
                            Found in old_test/reheat/index.test.js - About 2 hrs to fix

                              Function timestampsIsNew has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  timestampsIsNew: function (test) {
                                      test.expect(5);
                              
                                      var instance = {
                                          attributes: {
                              Severity: Major
                              Found in old_test/reheat/model/prototype/save.test.js - About 2 hrs to fix

                                Function timestampsNotNew has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    timestampsNotNew: function (test) {
                                        test.expect(5);
                                
                                        var instance = {
                                            attributes: {
                                Severity: Major
                                Found in old_test/reheat/model/prototype/save.test.js - About 2 hrs to fix

                                  Function normal has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      normal: function (test) {
                                          test.expect(7);
                                  
                                          var instance = {
                                              attributes: {
                                  Severity: Major
                                  Found in old_test/reheat/model/prototype/destroy.test.js - About 2 hrs to fix

                                    File save.test.js has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    /*jshint loopfunc:true*/
                                    
                                    var SandboxedModule = require('sandboxed-module'),
                                        errors = require('../../../../../build/instrument/lib/support/errors'),
                                        support = require('../../../../support/support'),
                                    Severity: Minor
                                    Found in old_test/reheat/model/prototype/save.test.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language