netceteragroup/valdr

View on GitHub
src/message/valdrMessage-directive.spec.js

Summary

Maintainability
F
4 days
Test Coverage

File valdrMessage-directive.spec.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
Open

describe('valdrMessage input directive', function () {

  var $scope, $compile;

  beforeEach(module('valdr'));
Severity: Minor
Found in src/message/valdrMessage-directive.spec.js - About 3 hrs to fix

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

      it('should update field names on language switch at runtime', function () {
        // given
        valdrMessage.setTemplate('<div>{{ violations[0].fieldName }}</div>');
        var element = compileTemplate();
        expect(element.find('div').html()).toBe('Field Name');
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 1 other location - About 4 hrs to fix
    src/message/valdrMessage-directive.spec.js on lines 442..454

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

    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

      it('should update field names on language switch at runtime', function () {
        // given
        valdrMessage.setTemplate('<div>{{ violations[0].fieldName }}</div>');
        var element = compileTemplate();
        expect(element.find('div').html()).toBe('The Field Name');
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 1 other location - About 4 hrs to fix
    src/message/valdrMessage-directive.spec.js on lines 317..329

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

    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

      it('should NOT add valdr-message after the input if valdr-no-validate is set', function () {
        // given
        var element = compileTemplate(
            '<form name="demoForm">' +
              '<div valdr-type="TestClass" valdr-form-group>' +
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 2 other locations - About 2 hrs to fix
    src/message/valdrMessage-directive.spec.js on lines 61..76
    src/message/valdrMessage-directive.spec.js on lines 78..93

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

    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

      it('should NOT add a the valdr-message after the input is not wrapped in a valdr-type', function () {
        // given
        var element = compileTemplate(
          '<form name="demoForm">' +
            '<div>' +
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 2 other locations - About 2 hrs to fix
    src/message/valdrMessage-directive.spec.js on lines 61..76
    src/message/valdrMessage-directive.spec.js on lines 95..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 91.

    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

      it('should NOT add a the valdr-message after the input if valdr-no-message is set', function () {
        // given
        var element = compileTemplate(
          '<form name="demoForm">' +
            '<div valdr-form-group valdr-type="TestClass">' +
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 2 other locations - About 2 hrs to fix
    src/message/valdrMessage-directive.spec.js on lines 78..93
    src/message/valdrMessage-directive.spec.js on lines 95..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 91.

    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

      it('should translate the field name to german using the fieldNameKeyGenerator', function () {
        // given
        $translate.use('de');
        valdrMessage.setTemplate('<div>{{ violations[0].fieldName }}</div>');
    
    
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 1 other location - About 2 hrs to fix
    src/message/valdrMessage-directive.spec.js on lines 305..315

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

    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

      it('should translate the field name to german', function () {
        // given
        $translate.use('de');
        valdrMessage.setTemplate('<div>{{ violations[0].fieldName }}</div>');
    
    
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 1 other location - About 2 hrs to fix
    src/message/valdrMessage-directive.spec.js on lines 430..440

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

    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

      it('should translate the field name', function () {
        // given
        valdrMessage.setTemplate('<div>{{ violations[0].fieldName }}</div>');
    
        // when
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 2 other locations - About 1 hr to fix
    src/message/valdrMessage-directive.spec.js on lines 173..182
    src/message/valdrMessage-directive.spec.js on lines 419..428

    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

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

      it('should translate the field name using the fieldNameKeyGenerator', function () {
        // given
        valdrMessage.setTemplate('<div>{{ violations[0].fieldName }}</div>');
    
        // when
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 2 other locations - About 1 hr to fix
    src/message/valdrMessage-directive.spec.js on lines 173..182
    src/message/valdrMessage-directive.spec.js on lines 294..303

    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

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

      it('should support custom templates', function () {
        // given
        valdrMessage.setTemplate('<div>Number of violations: {{ violations.length }}</div>');
    
        // when
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 2 other locations - About 1 hr to fix
    src/message/valdrMessage-directive.spec.js on lines 294..303
    src/message/valdrMessage-directive.spec.js on lines 419..428

    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

      beforeEach(inject(function ($rootScope, _$compile_, _valdrMessage_, _$translate_) {
        $compile = _$compile_;
        $scope = $rootScope.$new();
        $translate = _$translate_;
        valdrMessage = _valdrMessage_;
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 1 other location - About 1 hr to fix
    src/message/valdrMessage-directive.spec.js on lines 287..292

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

    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

      beforeEach(inject(function ($rootScope, _$compile_, _valdrMessage_, _$translate_) {
        $compile = _$compile_;
        $scope = $rootScope.$new();
        $translate = _$translate_;
        valdrMessage = _valdrMessage_;
    Severity: Major
    Found in src/message/valdrMessage-directive.spec.js and 1 other location - About 1 hr to fix
    src/message/valdrMessage-directive.spec.js on lines 412..417

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

    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