patternfly/angular-patternfly

View on GitHub
src/wizard/wizard-step.component.js

Summary

Maintainability
F
6 days
Test Coverage

Function controller has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
Open

  controller: function ($timeout, $scope) {
    'use strict';

    var ctrl = this,
      firstRun;
Severity: Minor
Found in src/wizard/wizard-step.component.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  controller: function ($timeout, $scope) {
    'use strict';

    var ctrl = this,
      firstRun;
Severity: Major
Found in src/wizard/wizard-step.component.js - About 1 day to fix

    File wizard-step.component.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @ngdoc directive
     * @name patternfly.wizard.directive:pfWizardStep
     * @restrict E
     *
    Severity: Minor
    Found in src/wizard/wizard-step.component.js - About 2 hrs to fix

      Function $onInit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ctrl.$onInit = function () {
            firstRun = true;
            ctrl.steps = [];
            ctrl.context = {};
            ctrl.title =  ctrl.stepTitle;
      Severity: Minor
      Found in src/wizard/wizard-step.component.js - About 1 hr to fix

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

            ctrl.goTo = function (step) {
              var focusElement = null;
        
              if (ctrl.wizard.isWizardDone() || !step.okToNavAway || step === ctrl.selectedStep) {
                return;
        Severity: Minor
        Found in src/wizard/wizard-step.component.js - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

                return true;
          Severity: Major
          Found in src/wizard/wizard-step.component.js - About 30 mins to fix

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

                      $timeout(function () {
                        if (step.focusSelectors) {
                          _.find(step.focusSelectors, function (selector) {
                            return focusElement = document.querySelector(selector);
                          });
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 5 hrs to fix
            src/wizard/wizard.component.js on lines 189..209

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

            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

                ctrl.isPrevEnabled = function () {
                  var enabled = angular.isUndefined(ctrl.prevEnabled) || ctrl.prevEnabled;
                  if (ctrl.substeps && ctrl.selectedStep) {
                    enabled = enabled && ctrl.selectedStep.isPrevEnabled();
                  }
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 2 hrs to fix
            src/wizard/wizard-step.component.js on lines 190..196

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

            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

                ctrl.isNextEnabled = function () {
                  var enabled = angular.isUndefined(ctrl.nextEnabled) || ctrl.nextEnabled;
                  if (ctrl.substeps && ctrl.selectedStep) {
                    enabled = enabled && ctrl.selectedStep.isNextEnabled();
                  }
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 2 hrs to fix
            src/wizard/wizard-step.component.js on lines 198..204

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

            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 stepIdx = function (step) {
                  var idx = 0;
                  var res = -1;
                  angular.forEach(ctrl.getEnabledSteps(), function (currStep) {
                    if (currStep === step) {
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 2 hrs to fix
            src/wizard/wizard.component.js on lines 35..45

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

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

                var findWizard = function (scope) {
                  var wizard;
                  if (scope) {
                    if (angular.isDefined(scope.wizard)) {
                      wizard = scope.wizard;
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 3 other locations - About 2 hrs to fix
            src/wizard/wizard-buttons.js on lines 4..16
            src/wizard/wizard-review-page.component.js on lines 23..34
            src/wizard/wizard-substep.component.js on lines 47..59

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

            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

                var stepByTitle = function (titleToFind) {
                  var foundStep = null;
                  angular.forEach(ctrl.getEnabledSteps(), function (step) {
                    if (step.stepTitle === titleToFind) {
                      foundStep = step;
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 1 hr to fix
            src/wizard/wizard.component.js on lines 56..64

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

            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 unselectAll = function () {
                  //traverse steps array and set each "selected" property to false
                  angular.forEach(ctrl.getEnabledSteps(), function (step) {
                    step.selected = false;
                  });
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 1 hr to fix
            src/wizard/wizard.component.js on lines 47..54

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

            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 (changesObj.prevTooltip) {
                    if (_.get(ctrl.wizard, 'selectedStep') === ctrl) {
                      ctrl.wizard.prevTooltip = changesObj.prevTooltip.currentValue;
                    }
                  }
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 1 hr to fix
            src/wizard/wizard-step.component.js on lines 151..155

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

            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 (changesObj.nextTooltip) {
                    if (_.get(ctrl.wizard, 'selectedStep') === ctrl) {
                      ctrl.wizard.nextTooltip = changesObj.nextTooltip.currentValue;
                    }
                  }
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 1 hr to fix
            src/wizard/wizard-step.component.js on lines 157..161

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

            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

                  if (insertBefore) {
                    ctrl.steps.splice(ctrl.steps.indexOf(insertBefore), 0, step);
                  } else {
                    ctrl.steps.push(step);
                  }
            Severity: Major
            Found in src/wizard/wizard-step.component.js and 1 other location - About 1 hr to fix
            src/wizard/wizard.component.js on lines 263..267

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 55.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                  if (angular.isUndefined(ctrl.stepPriority)) {
                    ctrl.stepPriority = 999;
                  } else {
                    ctrl.stepPriority = parseInt(ctrl.stepPriority);
                  }
            Severity: Minor
            Found in src/wizard/wizard-step.component.js and 1 other location - About 55 mins to fix
            src/wizard/wizard-substep.component.js on lines 72..76

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

            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

                ctrl.getEnabledSteps = function () {
                  return ctrl.steps.filter(function (step) {
                    return step.disabled !== 'true';
                  });
                };
            Severity: Minor
            Found in src/wizard/wizard-step.component.js and 1 other location - About 40 mins to fix
            src/wizard/wizard.component.js on lines 145..149

            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