patternfly/angular-patternfly

View on GitHub

Showing 300 of 300 total issues

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

      if (Math.floor(py * x / y) * py < n) {
        sy = x / Math.ceil(x * py / y);
      } else {
        sy = y / py;
      }
Severity: Major
Found in src/charts/heatmap/heatmap.component.js and 1 other location - About 1 hr to fix
src/charts/heatmap/heatmap.component.js on lines 221..225

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

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

    function clearAllFilters (evt) {
      evt.preventDefault();

      ctrl.config.appliedFilters = [];

Severity: Major
Found in src/filters/simple-filter/filter-results-component.js and 1 other location - About 1 hr to fix
src/filters/filter-panel/filter-panel-results-component.js on lines 75..83

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

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

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

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

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

Refactorings

Further Reading

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

  controller: function () {
    'use strict';

    var ctrl = this;
    var prevConfig;
Severity: Minor
Found in src/filters/simple-filter/filter-results-component.js - About 1 hr to fix

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

          if (ctrl.sparklineChartId === undefined) {
            ctrl.sparklineChartId = 'sparklineChart';
            if (ctrl.config.chartId) {
              ctrl.sparklineChartId = ctrl.config.chartId + ctrl.sparklineChartId;
            }
    Severity: Major
    Found in src/charts/sparkline/sparkline-chart.component.js and 1 other location - About 1 hr to fix
    src/charts/line/line-chart.component.js on lines 147..152

    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

          if (ctrl.lineChartId === undefined) {
            ctrl.lineChartId = 'lineChart';
            if (ctrl.config.chartId) {
              ctrl.lineChartId = ctrl.config.chartId + ctrl.lineChartId;
            }
    Severity: Major
    Found in src/charts/line/line-chart.component.js and 1 other location - About 1 hr to fix
    src/charts/sparkline/sparkline-chart.component.js on lines 165..170

    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

    Function startDrag has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          startDrag: function (evt, config) {
            var dragging = false;
            var x = evt.pageX;
            var y = evt.pageY;
    
    
    Severity: Minor
    Found in src/canvas-view/canvas/dragging-service.js - About 1 hr to fix

      Function jsFiddle has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      directive.jsFiddle = function(getEmbeddedTemplate, escape, script) {
        return {
          terminal: true,
          link: function(scope, element, attr) {
            var name = '',
      Severity: Minor
      Found in misc/angular-bootstrap-prettify.js - About 1 hr to fix

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

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

          Function itemClick has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              ctrl.itemClick = function (e, item) {
                var alreadySelected;
                var selectionChanged = false;
                var continueEvent = true;
                var enableRowExpansion = ctrl.config && ctrl.config.useExpandingRows && !ctrl.config.compoundExpansionOnly && item && !item.disableRowExpansion;
          Severity: Minor
          Found in src/views/listview/list-view.component.js - About 1 hr to fix

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

                ctrl.handleMenuAction = function (action, item) {
                  if (!ctrl.checkDisabled(item) && action && action.actionFn && (action.isDisabled !== true)) {
                    action.actionFn(action, item);
                  }
                };
            Severity: Major
            Found in src/views/listview/list-view.component.js and 1 other location - About 1 hr to fix
            src/table/tableview/table-view.component.js on lines 434..438

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

            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.handleMenuAction = function (action, item) {
                  if (!ctrl.checkDisabled(item) && action && action.actionFn && (action.isDisabled !== true)) {
                    action.actionFn(action, item);
                  }
                };
            Severity: Major
            Found in src/table/tableview/table-view.component.js and 1 other location - About 1 hr to fix
            src/views/listview/list-view.component.js on lines 80..84

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

            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

                this.middleX = function(scale) {
                  if (angular.isUndefined(scale)) {
                    scale = 0.5;
                  }
            
            
            Severity: Major
            Found in src/canvas-view/canvas/canvas-viewmodel.js and 1 other location - About 1 hr to fix
            src/canvas-view/canvas/canvas-viewmodel.js on lines 517..523

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

            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

                this.middleY = function(scale) {
                  if (angular.isUndefined(scale)) {
                    scale = 0.5;
                  }
            
            
            Severity: Major
            Found in src/canvas-view/canvas/canvas-viewmodel.js and 1 other location - About 1 hr to fix
            src/canvas-view/canvas/canvas-viewmodel.js on lines 509..515

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

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

                  ctrl.openModal = function () {
                    $uibModal.open({
                      component: 'pfModalContent',
                      resolve: {
                        content: function () {
            Severity: Minor
            Found in src/modals/about-modal/about-modal.component.js - About 1 hr to fix

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

                controller: function ($scope) {
                  'use strict';
                  var ctrl = this;
              
                  var findWizard = function (scope) {
              Severity: Minor
              Found in src/wizard/wizard-review-page.component.js - About 1 hr 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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                controller: function ($filter) {
                  'use strict';
                  var ctrl = this, prevConfig;
              
                  ctrl.defaultConfig = {
              Severity: Minor
              Found in src/views/empty-state.component.js - About 1 hr 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

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

                      } else if (item.navUnHoverTimeout === undefined) {
                        item.navUnHoverTimeout = $timeout(function () {
                          item.isHover = false;
                          if (!secondaryHover()) {
                            ctrl.hoverTertiaryNav = false;
              Severity: Major
              Found in src/navigation/vertical-navigation.component.js and 1 other location - About 1 hr to fix
              src/navigation/vertical-navigation.component.js on lines 445..453

              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

              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.title === titleToFind) {
                        foundStep = step;
              Severity: Major
              Found in src/wizard/wizard.component.js and 1 other location - About 1 hr to fix
              src/wizard/wizard-step.component.js on lines 78..86

              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

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

                      } else if (item.navUnHoverTimeout === undefined && item.isHover) {
                        item.navUnHoverTimeout = $timeout(function () {
                          item.isHover = false;
                          if (!primaryHover()) {
                            ctrl.hoverSecondaryNav = false;
              Severity: Major
              Found in src/navigation/vertical-navigation.component.js and 1 other location - About 1 hr to fix
              src/navigation/vertical-navigation.component.js on lines 480..488

              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

              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

              Severity
              Category
              Status
              Source
              Language