netceteragroup/valdr

View on GitHub

Showing 72 of 72 total issues

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

Function link has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      link: function (scope, element, attrs, controllers) {
        var formController = controllers[0],
          valdrTypeController = controllers[1] || nullValdrType;

        var updateTranslations = function () {
Severity: Major
Found in src/message/valdrMessage-directive.js - About 2 hrs to fix

    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 return true for empty values', function () {
        expect(maxValidator.validate('', constraint)).toBe(true);
        expect(maxValidator.validate(null, constraint)).toBe(true);
        expect(maxValidator.validate(undefined, constraint)).toBe(true);
      });
    Severity: Major
    Found in src/core/validators/maxValidator.spec.js and 2 other locations - About 2 hrs to fix
    src/core/validators/digitsValidator.spec.js on lines 16..20
    src/core/validators/minValidator.spec.js on lines 16..20

    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 return true for empty values', function () {
        expect(minValidator.validate('', constraint)).toBe(true);
        expect(minValidator.validate(null, constraint)).toBe(true);
        expect(minValidator.validate(undefined, constraint)).toBe(true);
      });
    Severity: Major
    Found in src/core/validators/minValidator.spec.js and 2 other locations - About 2 hrs to fix
    src/core/validators/digitsValidator.spec.js on lines 16..20
    src/core/validators/maxValidator.spec.js on lines 16..20

    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 return true for empty, null, and undefined', function () {
        expect(digitsValidator.validate('', constraint)).toBe(true);
        expect(digitsValidator.validate(null, constraint)).toBe(true);
        expect(digitsValidator.validate(undefined, constraint)).toBe(true);
      });
    Severity: Major
    Found in src/core/validators/digitsValidator.spec.js and 2 other locations - About 2 hrs to fix
    src/core/validators/maxValidator.spec.js on lines 16..20
    src/core/validators/minValidator.spec.js on lines 16..20

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

    Function controller has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          controller: ['$scope', '$element', function ($scope, $element) {
    
            var formItems = [],
              messageElements = {};
    
    
    Severity: Major
    Found in src/core/valdrFormGroup-directive.js - About 2 hrs to fix

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

      angular.module('valdr')
      
        .factory('valdrEmailValidator', ['valdrUtil', function (valdrUtil) {
      
          // the e-mail pattern used in angular.js
      Severity: Major
      Found in src/core/validators/emailValidator.js and 1 other location - About 2 hrs to fix
      src/core/validators/urlValidator.js on lines 1..21

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

      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

      angular.module('valdr')
      
        .factory('valdrUrlValidator', ['valdrUtil', function (valdrUtil) {
      
          // the url pattern used in angular.js
      Severity: Major
      Found in src/core/validators/urlValidator.js and 1 other location - About 2 hrs to fix
      src/core/validators/emailValidator.js on lines 1..21

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

      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 return true for empty values', function () {
          expect(futureValidator.validate('')).toBe(true);
          expect(futureValidator.validate(null)).toBe(true);
          expect(futureValidator.validate(undefined)).toBe(true);
        });
      Severity: Major
      Found in src/core/validators/futureValidator.spec.js and 1 other location - About 2 hrs to fix
      src/core/validators/pastValidator.spec.js on lines 15..19

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

      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 return true for empty values', function () {
          expect(pastValidator.validate('')).toBe(true);
          expect(pastValidator.validate(null)).toBe(true);
          expect(pastValidator.validate(undefined)).toBe(true);
        });
      Severity: Major
      Found in src/core/validators/pastValidator.spec.js and 1 other location - About 2 hrs to fix
      src/core/validators/futureValidator.spec.js on lines 15..19

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

      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

      angular.module('valdr')
      
        .factory('valdrFutureValidator', ['futureAndPastSharedValidator', function (futureAndPastSharedValidator) {
      
          return {
      Severity: Major
      Found in src/core/validators/futureValidator.js and 1 other location - About 2 hrs to fix
      src/core/validators/pastValidator.js on lines 1..20

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

      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

      angular.module('valdr')
      
        .factory('valdrPastValidator', ['futureAndPastSharedValidator', function (futureAndPastSharedValidator) {
      
          return {
      Severity: Major
      Found in src/core/validators/pastValidator.js and 1 other location - About 2 hrs to fix
      src/core/validators/futureValidator.js on lines 1..21

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

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

      var valdrFormItemDirectiveDefinitionFactory = function (restrict) {
          return ['valdrEvents', 'valdr', 'valdrUtil', function (valdrEvents, valdr, valdrUtil) {
            return {
              restrict: restrict,
              require: ['?^valdrType', '?^ngModel', '?^valdrFormGroup', '?^valdrEnabled'],
      Severity: Major
      Found in src/core/valdrFormItem-directive.js - About 2 hrs to fix

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

            this.$get = ['$templateCache', '$injector', function ($templateCache, $injector) {
        
              var angularMessagesEnabled = false;
        
              function getTranslateService() {
        Severity: Minor
        Found in src/message/valdrMessage-service.js - About 1 hr to fix

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

                  link: function (scope, element, attrs, controllers) {
          
                    var valdrTypeController = controllers[0],
                      ngModelController = controllers[1],
                      valdrFormGroupController = controllers[2] || nullValdrFormGroupController,
          Severity: Minor
          Found in src/core/valdrFormItem-directive.js - About 1 hr to fix

            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

            Severity
            Category
            Status
            Source
            Language