jmdobry/reheat

View on GitHub

Showing 296 of 296 total issues

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

    tearDown: function (cb) {
        connection.run(r.dbList())
            .then(function (dbList) {
                if (mout.array.contains(dbList, 'test')) {
                    return connection.run(r.dbDrop('test'));
Severity: Major
Found in old_test/model/index.test.js and 1 other location - About 5 hrs to fix
old_test/connection/index.test.js on lines 38..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 146.

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

    tearDown: function (cb) {
        connection.run(r.dbList())
            .then(function (dbList) {
                if (mout.array.contains(dbList, 'test')) {
                    return connection.run(r.dbDrop('test'));
Severity: Major
Found in old_test/connection/index.test.js and 1 other location - About 5 hrs to fix
old_test/model/index.test.js on lines 40..56

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

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

module.exports = function (Collection_save, utils, errors, Promise) {

  var protoProps = {

    /**
Severity: Major
Found in lib/collection/prototype/index.js - About 5 hrs to fix

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

      function save(options, cb) {
        var relationsToMerge = {};
        var childRelations = {};
        var Model = this.constructor;
    
    
    Severity: Major
    Found in lib/model/prototype/save.js - About 5 hrs to fix

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

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

        Function findOne has 130 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function findOne(primaryKey, options, cb) {
            var models = container.get('models');
            var newModels = {};
            var merge = {};
            var query;
        Severity: Major
        Found in lib/model/static/findOne.js - About 5 hrs to fix

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

          module.exports = function (container, Promise, utils, errors) {
            var IllegalArgumentError = errors.IllegalArgumentError;
            var RuntimeError = errors.RuntimeError;
            var errorPrefix = 'Model.load(relations[, options][, cb]): ';
          
          
          Severity: Major
          Found in lib/model/prototype/load.js - About 5 hrs to fix

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

            module.exports = function (Promise, utils, errors) {
              var IllegalArgumentError = errors.IllegalArgumentError;
            
              /**
               * @doc method
            Severity: Minor
            Found in lib/model/prototype/set.js - About 5 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 125 lines of code (exceeds 25 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: Major
            Found in lib/model/prototype/index.js - About 5 hrs to fix

              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

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

                                var JSONposts = [
                                    {
                                        title: 'post1',
                                        id: post1.get(Post.idAttribute),
                                        userId: tempUser.get(User.idAttribute)
                Severity: Major
                Found in old_test/model/static/relations.test.js and 1 other location - About 4 hrs to fix
                old_test/model/static/relations.test.js on lines 405..421

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

                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

                                var JSONposts = [
                                    {
                                        title: 'post1',
                                        id: post1.get(Post.idAttribute),
                                        userId: tempUser.get(User.idAttribute)
                Severity: Major
                Found in old_test/model/static/relations.test.js and 1 other location - About 4 hrs to fix
                old_test/model/static/relations.test.js on lines 347..363

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

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

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

                                optionsAndCallback: function (test) {
                                    var _this = this;
                                    test.expect(2);
                        
                                    this.connection.configure({
                        Severity: Major
                        Found in old_test/reheat/connection/index.test.js and 1 other location - About 3 hrs to fix
                        old_test/reheat/connection/index.test.js on lines 63..74

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

                        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

                                optionsOnly: function (test) {
                                    var _this = this;
                                    test.expect(2);
                        
                                    this.connection.configure({
                        Severity: Major
                        Found in old_test/reheat/connection/index.test.js and 1 other location - About 3 hrs to fix
                        old_test/reheat/connection/index.test.js on lines 75..87

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

                        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