xebia/angular-form-messages

View on GitHub

Showing 38 of 38 total issues

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

module.exports = function (grunt) {

  require('load-grunt-tasks')(grunt);

  var
Severity: Major
Found in Gruntfile.js - About 5 hrs to fix

    File afFieldSpec.js has 345 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    describe('afField', function () {
      var
        $scope,
        afField,
        afSubmit,
    Severity: Minor
    Found in test/spec/afFieldSpec.js - About 4 hrs to fix

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

          describe('when showSuccess is false on the afSubmit directive', function () {
            beforeEach(_.partial(showSuccess, false));
      
            describe('when the validation is "valid"', function () {
              beforeEach(noMessageSetup);
      Severity: Major
      Found in test/spec/bootstrap/afFeedbackSpec.js and 1 other location - About 3 hrs to fix
      test/spec/bootstrap/afFeedbackSpec.js on lines 80..100

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

      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

          describe('when showSuccess is true on the afSubmit directive', function () {
            beforeEach(_.partial(showSuccess, true));
      
            describe('when the validation is "valid"', function () {
              beforeEach(noMessageSetup);
      Severity: Major
      Found in test/spec/bootstrap/afFeedbackSpec.js and 1 other location - About 3 hrs to fix
      test/spec/bootstrap/afFeedbackSpec.js on lines 102..122

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

      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

          describe('when the fieldName is passed via the fieldName attribute', function () {
            beforeEach(function () {
              mox.get.AfMessageService.validation.calls.reset();
              compileHtml('<form name="userForm" af-submit><div af-messages af-field-name="user.name"></div></form>');
            });
      Severity: Major
      Found in test/spec/bootstrap/afMessagesSpec.js and 1 other location - About 3 hrs to fix
      test/spec/bootstrap/afMessagesSpec.js on lines 103..112

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

      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

          describe('when there is a fieldNamePrefix passed', function () {
            beforeEach(function () {
              mox.get.AfMessageService.validation.calls.reset();
              compileHtml('<form name="userForm" af-submit><div af-messages af-field-name-prefix="user"></div></form>');
            });
      Severity: Major
      Found in test/spec/bootstrap/afMessagesSpec.js and 1 other location - About 3 hrs to fix
      test/spec/bootstrap/afMessagesSpec.js on lines 92..101

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

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

          link: function linkFn($scope, elem, attrs, ctrls) {
            var
              ngModel = ctrls[0],
              afField = ctrls[1],
              submit = ctrls[2],
      Severity: Major
      Found in src/afField.js - About 2 hrs to fix

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

          describe('scrollToError', function () {
            it('should return the configured scrollToError value', function () {
              expect(inj.AfMessageService.scrollToError()).toBe(true);
        
              afMessageServiceProvider.setScrollToError(false);
        Severity: Major
        Found in test/spec/afMessageServiceSpec.js and 1 other location - About 2 hrs to fix
        test/spec/afMessageServiceSpec.js on lines 59..66

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

        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

          describe('showSuccess', function () {
            it('should return the configured showSuccess value', function () {
              expect(inj.AfMessageService.showSuccess()).toBe(false);
        
              afMessageServiceProvider.setShowSuccess(true);
        Severity: Major
        Found in test/spec/afMessageServiceSpec.js and 1 other location - About 2 hrs to fix
        test/spec/afMessageServiceSpec.js on lines 41..48

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

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

              }, post: function ($scope, elem, attrs, ctrls) {
                var
                  afSubmitCtrl = ctrls[1],
                  formCtrl = ctrls[0],
                  formName = $interpolate(formCtrl.$name)($scope);
        Severity: Major
        Found in src/afSubmit.js - About 2 hrs to fix

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

                describe('when there is a "warning" message', function () {
                  beforeEach(function () {
                    setup([inj.MESSAGE_TYPES[2]]);
                  });
          
          
          Severity: Major
          Found in test/spec/bootstrap/afFieldStateSpec.js and 4 other locations - About 2 hrs to fix
          test/spec/bootstrap/afFieldStateSpec.js on lines 155..164
          test/spec/bootstrap/afFieldStateSpec.js on lines 166..175
          test/spec/bootstrap/afFieldStateSpec.js on lines 210..219
          test/spec/bootstrap/afFieldStateSpec.js on lines 221..230

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

                describe('when there is a "success" message', function () {
                  beforeEach(function () {
                    setup([inj.MESSAGE_TYPES[0]]);
                  });
          
          
          Severity: Major
          Found in test/spec/bootstrap/afFieldStateSpec.js and 4 other locations - About 2 hrs to fix
          test/spec/bootstrap/afFieldStateSpec.js on lines 144..153
          test/spec/bootstrap/afFieldStateSpec.js on lines 155..164
          test/spec/bootstrap/afFieldStateSpec.js on lines 210..219
          test/spec/bootstrap/afFieldStateSpec.js on lines 221..230

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

                describe('when there is an "error" message', function () {
                  beforeEach(function () {
                    setup([inj.MESSAGE_TYPES[3]]);
                  });
          
          
          Severity: Major
          Found in test/spec/bootstrap/afFieldStateSpec.js and 4 other locations - About 2 hrs to fix
          test/spec/bootstrap/afFieldStateSpec.js on lines 144..153
          test/spec/bootstrap/afFieldStateSpec.js on lines 155..164
          test/spec/bootstrap/afFieldStateSpec.js on lines 166..175
          test/spec/bootstrap/afFieldStateSpec.js on lines 221..230

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

                describe('when there is an "info" message', function () {
                  beforeEach(function () {
                    setup([inj.MESSAGE_TYPES[1]]);
                  });
          
          
          Severity: Major
          Found in test/spec/bootstrap/afFieldStateSpec.js and 4 other locations - About 2 hrs to fix
          test/spec/bootstrap/afFieldStateSpec.js on lines 144..153
          test/spec/bootstrap/afFieldStateSpec.js on lines 166..175
          test/spec/bootstrap/afFieldStateSpec.js on lines 210..219
          test/spec/bootstrap/afFieldStateSpec.js on lines 221..230

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

                describe('when there is a "success" message', function () {
                  beforeEach(function () {
                    setup([inj.MESSAGE_TYPES[0]]);
                  });
          
          
          Severity: Major
          Found in test/spec/bootstrap/afFieldStateSpec.js and 4 other locations - About 2 hrs to fix
          test/spec/bootstrap/afFieldStateSpec.js on lines 144..153
          test/spec/bootstrap/afFieldStateSpec.js on lines 155..164
          test/spec/bootstrap/afFieldStateSpec.js on lines 166..175
          test/spec/bootstrap/afFieldStateSpec.js on lines 210..219

          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

          File afSubmitSpec.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          describe('afSubmit', function () {
            var
              $timeout,
              callbackResult = {
                validation: {
          Severity: Minor
          Found in test/spec/afSubmitSpec.js - About 2 hrs to fix

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

                this.$get = function (SHOW_MULTIPLE) {
            
                  var messageService = {
                    /**
                     * Determine the message with the highest severity from a list of messages
            Severity: Major
            Found in src/afMessageService.js - About 2 hrs to fix

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

                    link: function ($scope, elem, attrs, afSubmitCtrl) {
                      var typeToFieldStateClass = {};
                      typeToFieldStateClass[MESSAGE_TYPES[0]] = 'has-success';
                      typeToFieldStateClass[MESSAGE_TYPES[1]] = 'has-info';
                      typeToFieldStateClass[MESSAGE_TYPES[2]] = 'has-warning';
              Severity: Minor
              Found in src/bootstrap/afFieldState.js - About 2 hrs to fix

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

                    describe('when there is no fieldName', function () {
                      beforeEach(function () {
                        compileHtml('<div af-messages></div>');
                      });
                
                
                Severity: Major
                Found in test/spec/afMessagesSpec.js and 1 other location - About 1 hr to fix
                test/spec/afMessagesSpec.js on lines 25..33

                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

                    describe('when the fieldName is passed via the fieldName attribute', function () {
                      beforeEach(function () {
                        compileHtml('<div af-messages af-field-name="user.name"></div>');
                      });
                
                
                Severity: Major
                Found in test/spec/afMessagesSpec.js and 1 other location - About 1 hr to fix
                test/spec/afMessagesSpec.js on lines 35..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 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

                Severity
                Category
                Status
                Source
                Language