rx/presenters

View on GitHub
views/mdc/assets/js/mdl-stepper.js

Summary

Maintainability
F
4 days
Test Coverage

File mdl-stepper.js has 596 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
    This file was copied from the MDL Stepper Polyfill at https://ahlechandre.github.io/mdl-stepper/component/
    The stepper looks and behaves failry well but we wanted some specific behavior changes so pulled in a copy here.
 */

Severity: Major
Found in views/mdc/assets/js/mdl-stepper.js - About 1 day to fix

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

                MaterialStepper.prototype.updateStepState_ = function (step, state) {
                    /** @type {string} */
                    var stateClass;
                    /** @type {HTMLElement} */
                    var indicatorContent;
    Severity: Major
    Found in views/mdc/assets/js/mdl-stepper.js - About 2 hrs to fix

      Function next has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  MaterialStepper.prototype.next = function () {
                      /** @type {boolean} */
                      var moved;
                      /** @type {MaterialStepper.Steps_.collection<step>} */
                      var step;
      Severity: Minor
      Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix

        Function getStepModel_ has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    MaterialStepper.prototype.getStepModel_ = function (step, id) {
                        /** @type {Object} */
                        var model;
                        /** @type {string} */
                        var selectorActionsBack;
        Severity: Minor
        Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix

          Function back has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      MaterialStepper.prototype.back = function () {
                          /** @type {boolean} */
                          var moved;
                          /** @type {function} */
                          var moveStep;
          Severity: Minor
          Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix

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

                        MaterialStepper.prototype.getSteps_ = function () {
                            /** @type {array} */
                            var collection;
                            /** @type {number} */
                            var total;
            Severity: Minor
            Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix

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

                          MaterialStepper.prototype.setCustomEvents_ = function () {
                              /** @type {function} */
                              var linearLabels;
                              /** @type {function} */
                              var nonLinearLabels;
              Severity: Minor
              Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix

                Function setActive_ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            MaterialStepper.prototype.setActive_ = function (id) {
                                /** @type {HTMLElement | null} */
                                var active;
                                /** MaterialStepper.Steps_.collection<step> */
                                var first;
                Severity: Minor
                Found in views/mdc/assets/js/mdl-stepper.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if (moved && this.Stepper_.hasFeedback) {
                                                      // Remove the (feedback) transient effect before move
                                                      this.removeTransientEffect_(step);
                                                  }
                  Severity: Major
                  Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    if (step.labelTitleMessageText) {
                                                        this.updateTitleMessage_(step, step.labelTitleMessageText);
                                                    } else {
                                                        this.removeTitleMessage_(step);
                                                    }
                    Severity: Major
                    Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      for (item in this.Steps_.collection) {
                                                          // Rule eslint guard-for-in.
                                                          if (this.Steps_.collection.hasOwnProperty(item)) {
                                                              stepItem = this.Steps_.collection[item];
                      
                      
                      Severity: Major
                      Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                        if (previous.isEditable) {
                                                            moved = moveStep.bind(this)(previous);
                                                        }
                        Severity: Major
                        Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          if (step.isOptional || step.id === this.Steps_.total) {
                                                              this.updateStepState_(step, this.StepState_.COMPLETED);
                                                          }
                          Severity: Major
                          Found in views/mdc/assets/js/mdl-stepper.js - About 45 mins to fix

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

                                        MaterialStepper.prototype.dispatchEventOnStepSkip_ = function (step) {
                                            if (!step.actionsSkip) return false;
                            
                                            step.actionsSkip.addEventListener('click', function (event) {
                                                event.preventDefault();
                            Severity: Major
                            Found in views/mdc/assets/js/mdl-stepper.js and 2 other locations - About 3 hrs to fix
                            views/mdc/assets/js/mdl-stepper.js on lines 1016..1025
                            views/mdc/assets/js/mdl-stepper.js on lines 1049..1057

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

                            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

                                        MaterialStepper.prototype.dispatchEventOnStepBack_ = function (step) {
                                            if (!step.actionsBack) return false;
                            
                                            step.actionsBack.addEventListener('click', function (event) {
                                                event.preventDefault();
                            Severity: Major
                            Found in views/mdc/assets/js/mdl-stepper.js and 2 other locations - About 3 hrs to fix
                            views/mdc/assets/js/mdl-stepper.js on lines 1016..1025
                            views/mdc/assets/js/mdl-stepper.js on lines 1033..1041

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

                            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

                                        MaterialStepper.prototype.dispatchEventOnStepCancel_ = function (step) {
                                            if (!step.actionsCancel) return false;
                            
                                            step.actionsCancel.addEventListener('click', function (event) {
                                                event.preventDefault();
                            Severity: Major
                            Found in views/mdc/assets/js/mdl-stepper.js and 2 other locations - About 3 hrs to fix
                            views/mdc/assets/js/mdl-stepper.js on lines 1033..1041
                            views/mdc/assets/js/mdl-stepper.js on lines 1049..1057

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

                            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

                                        MaterialStepper.prototype.getActive = function () {
                                            return this.Steps_.collection[this.Steps_.active - 1].container;
                                        };
                            Severity: Major
                            Found in views/mdc/assets/js/mdl-stepper.js and 1 other location - About 1 hr to fix
                            views/mdc/assets/js/mdl-stepper.js on lines 349..351

                            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

                                        MaterialStepper.prototype.getActiveId = function () {
                                            return this.Steps_.collection[this.Steps_.active - 1].id;
                                        };
                            Severity: Major
                            Found in views/mdc/assets/js/mdl-stepper.js and 1 other location - About 1 hr to fix
                            views/mdc/assets/js/mdl-stepper.js on lines 341..343

                            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

                                        MaterialStepper.prototype.dispatchEventOnStepComplete_ = function (step) {
                                            step.container.dispatchEvent(this.CustomEvents_.onstepcomplete);
                                        };
                            Severity: Minor
                            Found in views/mdc/assets/js/mdl-stepper.js and 1 other location - About 40 mins to fix
                            views/mdc/assets/js/mdl-stepper.js on lines 978..980

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

                            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

                                        MaterialStepper.prototype.dispatchEventOnStepError_ = function (step) {
                                            step.container.dispatchEvent(this.CustomEvents_.onsteperror);
                                        };
                            Severity: Minor
                            Found in views/mdc/assets/js/mdl-stepper.js and 1 other location - About 40 mins to fix
                            views/mdc/assets/js/mdl-stepper.js on lines 967..969

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

                            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