jmdobry/reheat

View on GitHub

Showing 296 of 296 total issues

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/filter.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/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

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          function ValidationError(message, errors) {
            Error.call(this);
            Error.captureStackTrace(this, this.constructor);
          
            /**
          Severity: Major
          Found in lib/support/errors.js and 2 other locations - About 3 hrs to fix
          lib/support/errors.js on lines 112..187
          lib/support/errors.js on lines 216..291

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

          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 3 locations. Consider refactoring.
          Open

          function IllegalArgumentError(message, errors) {
            Error.call(this);
            Error.captureStackTrace(this, this.constructor);
          
            /**
          Severity: Major
          Found in lib/support/errors.js and 2 other locations - About 3 hrs to fix
          lib/support/errors.js on lines 216..291
          lib/support/errors.js on lines 320..400

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

          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 3 locations. Consider refactoring.
          Open

          function RuntimeError(message, errors) {
            Error.call(this);
            Error.captureStackTrace(this, this.constructor);
          
            /**
          Severity: Major
          Found in lib/support/errors.js and 2 other locations - About 3 hrs to fix
          lib/support/errors.js on lines 112..187
          lib/support/errors.js on lines 320..400

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

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

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

                      if (!utils.isString(relations) && !utils.isArray(relations)) {
                        throw new IllegalArgumentError(errorPrefix + 'relations: Must be a string or an array!', { actual: typeof relations, expected: 'string' });
                      } else if (!utils.isObject(options)) {
                        throw new IllegalArgumentError(errorPrefix + 'options: Must be an object!', { actual: typeof options, expected: 'object' });
                      }
              Severity: Major
              Found in lib/model/prototype/load.js and 1 other location - About 3 hrs to fix
              lib/collection/static/getAll.js on lines 106..110

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

              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

                    } 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' });
                    } else if (!utils.isObject(options)) {
                      throw new IllegalArgumentError(errorPrefix + 'options: Must be an object!', { actual: typeof options, expected: 'object' });
                    }
              Severity: Major
              Found in lib/collection/static/getAll.js and 1 other location - About 3 hrs to fix
              lib/model/prototype/load.js on lines 79..83

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

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

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

                        Model.connection = {
                            run: Promise.promisify(function (query, options, next) {
                                next(null, {
                                    profile: {},
                                    value: {
                Severity: Major
                Found in old_test/reheat/model/static/filter.test.js and 1 other location - About 3 hrs to fix
                old_test/reheat/model/static/getAll.test.js on lines 48..62

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

                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

                        Model.connection = {
                            run: Promise.promisify(function (query, options, next) {
                                next(null, {
                                    profile: {},
                                    value: {
                Severity: Major
                Found in old_test/reheat/model/static/getAll.test.js and 1 other location - About 3 hrs to fix
                old_test/reheat/model/static/filter.test.js on lines 48..62

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

                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

                        var instance = {
                            attributes: {
                                name: 'John',
                                id: 2
                            },
                Severity: Major
                Found in old_test/reheat/model/prototype/destroy.test.js and 1 other location - About 3 hrs to fix
                old_test/reheat/model/prototype/destroy.test.js on lines 262..281

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

                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

                        var instance = {
                            attributes: {
                                name: 'John',
                                id: 2
                            },
                Severity: Major
                Found in old_test/reheat/model/prototype/destroy.test.js and 1 other location - About 3 hrs to fix
                old_test/reheat/model/prototype/destroy.test.js on lines 157..176

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

                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

                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
                        Severity
                        Category
                        Status
                        Source
                        Language