jmdobry/reheat

View on GitHub

Showing 296 of 296 total issues

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

module.exports = function (utils, errors, Model_set, Model_setSync, Model_unset, Model_clear, Model_save, Model_destroy, Model_load) {

  return {

    /**
Severity: Minor
Found in lib/model/prototype/index.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

File Gruntfile.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module.exports = function (grunt) {

    require('jit-grunt')(grunt, {
    simplemocha: 'grunt-simple-mocha'
  });
Severity: Minor
Found in Gruntfile.js - About 2 hrs to fix

    Function set has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function set(key, value, options, cb) {
        var _this = this;
    
        // Check pre-conditions
        if (utils.isFunction(value)) {
    Severity: Major
    Found in lib/model/prototype/set.js - About 2 hrs to fix

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

              for (i = 0; i < support.TYPES_EXCEPT_STRING.length; i++) {
                  test.throws(
                      function () {
                          reheat.defineModel('Post', {
                              tableName: support.TYPES_EXCEPT_STRING[i]
      Severity: Major
      Found in old_test/reheat/index.test.js and 2 other locations - About 2 hrs to fix
      old_test/reheat/index.test.js on lines 34..43
      old_test/reheat/index.test.js on lines 45..54

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

      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

              for (i = 0; i < support.TYPES_EXCEPT_BOOLEAN.length; i++) {
                  test.throws(
                      function () {
                          reheat.defineModel('Post', {
                              timestamps: support.TYPES_EXCEPT_BOOLEAN[i]
      Severity: Major
      Found in old_test/reheat/index.test.js and 2 other locations - About 2 hrs to fix
      old_test/reheat/index.test.js on lines 23..32
      old_test/reheat/index.test.js on lines 45..54

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

      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

              for (i = 0; i < support.TYPES_EXCEPT_BOOLEAN.length; i++) {
                  test.throws(
                      function () {
                          reheat.defineModel('Post', {
                              softDelete: support.TYPES_EXCEPT_BOOLEAN[i]
      Severity: Major
      Found in old_test/reheat/index.test.js and 2 other locations - About 2 hrs to fix
      old_test/reheat/index.test.js on lines 23..32
      old_test/reheat/index.test.js on lines 34..43

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

      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 defineModel has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        reheat.defineModel = function (name, staticProps, protoProps) {
          if (!utils.isString(name)) {
            throw new errors.IllegalArgumentError(errorPrefix + 'name: Must be a string!', { name: { actual: typeof name, expected: 'string' } });
          } else if (models[name]) {
            throw new errors.RuntimeError(errorPrefix + 'name: A Model with that name already exists!');
      Severity: Minor
      Found in lib/index.js - About 2 hrs to fix

        Function findAll has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function findAll(predicate, options, cb) {
            if (utils.isFunction(options)) {
              cb = options;
              options = {};
            }
        Severity: Minor
        Found in lib/collection/static/findAll.js - About 1 hr to fix

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

                  Model.connection = {
                      run: Promise.promisify(function (query, options, next) {
                          next(null, {
                              toArray: function (cb) {
                                  cb(null, [
          Severity: Major
          Found in old_test/reheat/model/static/filter.test.js and 1 other location - About 1 hr to fix
          old_test/reheat/model/static/getAll.test.js on lines 18..28

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

          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

                      test.deepEqual(instance.meta, {
                          old_val: {
                              name: 'John',
                              id: 2,
                              updated: 5,
          Severity: Major
          Found in old_test/reheat/model/prototype/destroy.test.js and 1 other location - About 1 hr to fix
          old_test/reheat/model/prototype/destroy.test.js on lines 240..254

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

          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, {
                              toArray: function (cb) {
                                  cb(null, [
          Severity: Major
          Found in old_test/reheat/model/static/getAll.test.js and 1 other location - About 1 hr to fix
          old_test/reheat/model/static/filter.test.js on lines 18..28

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

          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

                          test.deepEqual(instance.meta, {
                              old_val: {
                                  name: 'John',
                                  id: 2,
                                  updated: 5,
          Severity: Major
          Found in old_test/reheat/model/prototype/destroy.test.js and 1 other location - About 1 hr to fix
          old_test/reheat/model/prototype/destroy.test.js on lines 212..226

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

          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 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (utils, errors) {
            var IllegalArgumentError = errors.IllegalArgumentError,
              ValidationError = errors.ValidationError,
              UnhandledError = errors.UnhandledError;
          
          
          Severity: Minor
          Found in lib/model/prototype/setSync.js - About 1 hr to fix

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

                        Model.filter({}, { raw: true }).then(function (instances) {
                            test.deepEqual(instances[0], { id: 5, name: 'John' });
                            test.deepEqual(instances[1], { id: 6, name: 'Sally' });
                            test.done();
                        });
            Severity: Major
            Found in old_test/reheat/model/static/filter.test.js and 2 other locations - About 1 hr to fix
            old_test/reheat/model/static/filter.test.js on lines 399..403
            old_test/reheat/model/static/getAll.test.js on lines 134..138

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

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

                        Model.filter({ pluck: ['name', 'id'] }, { raw: true }).then(function (instances) {
                            test.deepEqual(instances[0], { id: 5, name: 'John' });
                            test.deepEqual(instances[1], { id: 6, name: 'Sally' });
                            test.done();
                        });
            Severity: Major
            Found in old_test/reheat/model/static/filter.test.js and 2 other locations - About 1 hr to fix
            old_test/reheat/model/static/filter.test.js on lines 466..470
            old_test/reheat/model/static/getAll.test.js on lines 134..138

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

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

                        Model.getAll(['5', '6'], { index: 'id' }, { raw: true }).then(function (instances) {
                            test.deepEqual(instances[0], { id: 5, name: 'John' });
                            test.deepEqual(instances[1], { id: 6, name: 'Sally' });
                            test.done();
                        });
            Severity: Major
            Found in old_test/reheat/model/static/getAll.test.js and 2 other locations - About 1 hr to fix
            old_test/reheat/model/static/filter.test.js on lines 399..403
            old_test/reheat/model/static/filter.test.js on lines 466..470

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

            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

                    for (var i = 0; i < support.TYPES_EXCEPT_STRING.length; i++) {
                        test.throws(
                            function () {
                                instance.get(support.TYPES_EXCEPT_STRING[i]);
                            },
            Severity: Major
            Found in old_test/reheat/model/prototype/index.test.js and 1 other location - About 1 hr to fix
            old_test/reheat/model/prototype/index.test.js on lines 29..36

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

            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

                    for (var i = 0; i < support.TYPES_EXCEPT_STRING.length; i++) {
                        test.throws(
                            function () {
                                instance.escape(support.TYPES_EXCEPT_STRING[i]);
                            },
            Severity: Major
            Found in old_test/reheat/model/prototype/index.test.js and 1 other location - About 1 hr to fix
            old_test/reheat/model/prototype/index.test.js on lines 113..120

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

            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

              Model.findAll = function () {
                console.warn('Model#findAll is not recommended! Please use Collection#findAll.');
                var args = Array.prototype.slice(arguments);
                return this.collection.findAll.apply(this.collection, args);
              };
            Severity: Major
            Found in lib/model/index.js and 1 other location - About 1 hr to fix
            lib/model/index.js on lines 105..109

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

            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

              Model.filter = function () {
                console.warn('Model#filter is deprecated! Please use Collection#findAll.');
                var args = Array.prototype.slice(arguments);
                return this.collection.findAll.apply(this.collection, args);
              };
            Severity: Major
            Found in lib/model/index.js and 1 other location - About 1 hr to fix
            lib/model/index.js on lines 110..114

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

            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

            Severity
            Category
            Status
            Source
            Language