patternfly/angular-patternfly

View on GitHub

Showing 300 of 300 total issues

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

      ctrl.activeSubSubTab = function () {
        var activeSubTab = ctrl.activeSubTab();
        if (activeSubTab && activeSubTab.subtabs) {
          return activeSubTab.subtabs.filter(function (subsubtab) {
            return subsubtab.active;
Severity: Major
Found in src/canvas-view/canvas-editor/canvas-editor.component.js and 1 other location - About 2 hrs to fix
src/canvas-view/canvas-editor/canvas-editor.component.js on lines 122..130

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

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

    link: function(scope, element, attrs) {
      var modules = ['ngAnimate'],
          embedRootScope,
          deregisterEmbedRootScope;

Severity: Major
Found in misc/angular-bootstrap-prettify.js - About 2 hrs to fix

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

          var findWizardStep = function (scope) {
            var wizardStep;
    
            if (scope) {
              if (angular.isDefined(scope.wizardStep)) {
    Severity: Major
    Found in src/wizard/wizard-substep.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-step.component.js on lines 88..99

    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 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-review-page.component.js and 3 other locations - About 2 hrs to fix
    src/wizard/wizard-buttons.js on lines 4..16
    src/wizard/wizard-step.component.js on lines 88..99
    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 4 locations. Consider refactoring.
    Open

      var findWizard = function (scope) {
        var wizard;
    
        if (scope) {
          if (angular.isDefined(scope.wizard)) {
    Severity: Major
    Found in src/wizard/wizard-buttons.js and 3 other locations - About 2 hrs to fix
    src/wizard/wizard-review-page.component.js on lines 23..34
    src/wizard/wizard-step.component.js on lines 88..99
    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 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

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

      controller: function ($sce) {
        'use strict';
        var ctrl = this,
          _showClose;
    
    
    Severity: Minor
    Found in src/notification/toast-notification.component.js - About 2 hrs 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

      bindings: {
        config: '=?',
        pageConfig: '=?',
        items: '=',
        actionButtons: '=?',
    Severity: Major
    Found in src/views/listview/list-view.component.js and 1 other location - About 2 hrs to fix
    src/wizard/wizard-substep.component.js on lines 25..40

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

    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

      bindings: {
        stepTitle: '@',
        stepId: '@',
        stepPriority: '@',
        nextEnabled: '<?',
    Severity: Major
    Found in src/wizard/wizard-substep.component.js and 1 other location - About 2 hrs to fix
    src/views/listview/list-view.component.js on lines 2..17

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

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

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

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

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

    Refactorings

    Further Reading

    File canvas-component.js has 252 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function () {
      'use strict';
    
      angular.module('patternfly.canvas')
        .filter('trustAsResourceUrl', ['$sce', function ($sce) {
    Severity: Minor
    Found in src/canvas-view/canvas/canvas-component.js - About 2 hrs to fix

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

        controller: function ($sce) {
          'use strict';
          var ctrl = this,
            _showClose;
      
      
      Severity: Major
      Found in src/notification/toast-notification.component.js - About 2 hrs to fix

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

          controller: function ($filter) {
            'use strict';
            var ctrl = this, prevConfig;
        
            ctrl.defaultConfig = {
        Severity: Major
        Found in src/views/empty-state.component.js - About 2 hrs to fix

          Function Factory has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function Factory (mouseCapture) {
              //
              // Threshold for dragging.
              // When the mouse moves by at least this amount dragging starts.
              //
          Severity: Major
          Found in src/canvas-view/canvas/dragging-service.js - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                  if (!ctrl.drawerHidden &&
                    (changesObj.drawerHidden ||
                    changesObj.showMarkAllRead ||
                    changesObj.showClearAll ||
                    changesObj.actionButtonTitle ||
            Severity: Critical
            Found in src/notification/notification-drawer.component.js - About 2 hrs to fix

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

                    ctrl.items.forEach(function (item) {
                      item.isMobileItem = false;
                      if (item.children) {
                        item.children.forEach(function (nextSecondary) {
                          nextSecondary.isMobileItem = false;
              Severity: Major
              Found in src/navigation/vertical-navigation.component.js and 1 other location - About 2 hrs to fix
              src/navigation/vertical-navigation.component.js on lines 331..338

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

              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

                        item.children.forEach(function (secondary) {
                          secondary.isActive = false;
                          if (secondary.children) {
                            secondary.children.forEach(function (tertiary) {
                              tertiary.isActive = false;
              Severity: Major
              Found in src/navigation/vertical-navigation.component.js and 1 other location - About 2 hrs to fix
              src/navigation/vertical-navigation.component.js on lines 51..58

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

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

                  ctrl.drawNodes = function () {
                    var coordinates;
                    ctrl.nodes.forEach(function (node) {
                      var imgR = node.size * 0.7;
                      var highlight = ctrl.shouldHighlightNode(node);
              Severity: Minor
              Found in src/charts/topology-map/topologyMap.component.js - About 1 hr to fix

                Function reindentCode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                service.reindentCode = function() {
                  return function (text, spaces) {
                    if (!text) return text;
                    var lines = text.split(/\r?\n/);
                    var prefix = '      '.substr(0, spaces || 0);
                Severity: Minor
                Found in misc/angular-bootstrap-prettify.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

                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/filter-panel/filter-panel-results-component.js and 1 other location - About 1 hr to fix
                src/filters/simple-filter/filter-results-component.js on lines 90..98

                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

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

                      if (Math.floor(px * y / x) * px < n) {
                        sx = y / Math.ceil(px * y / x);
                      } else {
                        sx = x / px;
                      }
                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 227..231

                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

                Severity
                Category
                Status
                Source
                Language