moneyadviceservice/dough

View on GitHub

Showing 13 of 13 total issues

File Validation.js has 323 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @description Client side validation. Mirrors HTML5 validation API as much as possible.
 * Supported types are:
 * - `required`
 * - `minlength`
Severity: Minor
Found in assets/js/components/Validation.js - About 3 hrs to fix

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

      Validation.prototype._validateMax = function($field, value, max) {
        var validity = { name: 'max' },
            valueAsNumber = Number(value);
    
        if (isNaN(valueAsNumber) || valueAsNumber > max) {
    Severity: Major
    Found in assets/js/components/Validation.js and 1 other location - About 2 hrs to fix
    assets/js/components/Validation.js on lines 442..451

    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

      Validation.prototype._validateMin = function($field, value, min) {
        var validity = { name: 'min' },
            valueAsNumber = Number(value);
    
        if (isNaN(valueAsNumber) || valueAsNumber < min) {
    Severity: Major
    Found in assets/js/components/Validation.js and 1 other location - About 2 hrs to fix
    assets/js/components/Validation.js on lines 461..470

    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

    Function toggle has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      Collapsable.prototype.toggle = function(forceTo, focusTarget) {
        var func,
            label,
            expandedLabel,
            iconClass;
    Severity: Minor
    Found in assets/js/components/Collapsable.js - About 1 hr to fix

      Function _setupListeners has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ChatPopup.prototype._setupListeners = function() {
            var self = this;
            // on icon click open popup
            this.chatPopupIcon.click(function(event) {
              event.preventDefault();
      Severity: Minor
      Found in assets/js/components/ChatPopup.js - About 1 hr to fix

        Function refreshInlineErrors has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Validation.prototype.refreshInlineErrors = function() {
            if (!this.config.showInlineValidation) { return this; }
        
            this.$el.find('.form__row').each($.proxy(function(i, o) {
              var $formRow = $(o),
        Severity: Minor
        Found in assets/js/components/Validation.js - About 1 hr to fix

          Function _setUpBTTLink has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            BackToTop.prototype._setUpBTTLink = function() {
              var resizeProxy = $.proxy(this._resize, this);
              var scrollProxy = $.proxy(this._scroll, this);
              var self = this;
          
          
          Severity: Minor
          Found in assets/js/components/BackToTop.js - About 1 hr to fix

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

                    $selectedTriggers.closest('[' + selectors.triggerContainer + ']')
                        .removeClass(this.selectors.inactiveClass)
                        .addClass(this.selectors.activeClass);
            Severity: Major
            Found in assets/js/components/TabSelector.js and 1 other location - About 1 hr to fix
            assets/js/components/TabSelector.js on lines 273..275

            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

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

                    $unselectedTriggers.closest('[' + selectors.triggerContainer + ']')
                        .removeClass(this.selectors.activeClass)
                        .addClass(this.selectors.inactiveClass);
            Severity: Major
            Found in assets/js/components/TabSelector.js and 1 other location - About 1 hr to fix
            assets/js/components/TabSelector.js on lines 262..264

            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

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

                  } else {
                    this.chatPopup._raisedChatPopup(true, this.atSmallViewport);
                    if (this.covidBanner) {
                      this.covidBanner._raisedCovidBanner(true, this.atSmallViewport);
                    }
            Severity: Minor
            Found in assets/js/components/BackToTop.js and 1 other location - About 55 mins to fix
            assets/js/components/BackToTop.js on lines 98..103

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

                  if (this._getScrollAmount() < this.config.triggerPoint) {
                    this.chatPopup._raisedChatPopup(false, this.atSmallViewport);
                    if (this.covidBanner) {
                      this.covidBanner._raisedCovidBanner(false, this.atSmallViewport);
                    }
            Severity: Minor
            Found in assets/js/components/BackToTop.js and 1 other location - About 55 mins to fix
            assets/js/components/BackToTop.js on lines 103..108

            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

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

                  var $field = $(field),
                      existingDescribedBy = $field.attr('aria-describedby') || '',
                      inlineErrorID = this._getInlineErrorID($field.attr('name'));
            Severity: Minor
            Found in assets/js/components/Validation.js and 1 other location - About 40 mins to fix
            assets/js/components/Validation.js on lines 261..263

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

            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 $field = $(field),
                      existingDescribedBy = $field.attr('aria-describedby') || '',
                      inlineErrorID = this._getInlineErrorID($field.attr('name'));
            Severity: Minor
            Found in assets/js/components/Validation.js and 1 other location - About 40 mins to fix
            assets/js/components/Validation.js on lines 282..284

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

            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