jmdobry/reheat

View on GitHub
old_test/reheat/model/prototype/index.test.js

Summary

Maintainability
D
1 day
Test Coverage

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

        clone: function (test) {
            test.expect(3);
    
            function constructor(attrs) {
                return {
    Severity: Major
    Found in old_test/reheat/model/prototype/index.test.js - About 2 hrs to fix

      Function lifecycle has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          lifecycle: function (test) {
              test.expect(8);
      
              var instance = {
                  beforeValidate: prototype.beforeValidate,
      Severity: Minor
      Found in old_test/reheat/model/prototype/index.test.js - About 1 hr to fix

        Function isNew has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            isNew: function (test) {
                test.expect(2);
        
                var instance = {
                    attributes: {
        Severity: Minor
        Found in old_test/reheat/model/prototype/index.test.js - About 1 hr to fix

          Function get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              get: function (test) {
                  test.expect(11);
          
                  var instance = {
                      attributes: {
          Severity: Minor
          Found in old_test/reheat/model/prototype/index.test.js - About 1 hr to fix

            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

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

                    test.deepEqual(clone, {
                        attributes: {
                            name: 'John',
                            address: {
                                state: 'NY'
            Severity: Major
            Found in old_test/reheat/model/prototype/index.test.js and 2 other locations - About 55 mins to fix
            old_test/reheat/model/prototype/index.test.js on lines 165..175
            old_test/reheat/model/prototype/index.test.js on lines 176..186

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

            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

                    test.deepEqual(clone, {
                        attributes: {
                            name: 'Sally',
                            address: {
                                state: 'NY'
            Severity: Major
            Found in old_test/reheat/model/prototype/index.test.js and 2 other locations - About 55 mins to fix
            old_test/reheat/model/prototype/index.test.js on lines 153..163
            old_test/reheat/model/prototype/index.test.js on lines 165..175

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

            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

                    test.deepEqual(instance, {
                        attributes: {
                            name: 'John',
                            address: {
                                state: 'NY'
            Severity: Major
            Found in old_test/reheat/model/prototype/index.test.js and 2 other locations - About 55 mins to fix
            old_test/reheat/model/prototype/index.test.js on lines 153..163
            old_test/reheat/model/prototype/index.test.js on lines 176..186

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

            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

            There are no issues that match your filters.

            Category
            Status