IntegerMan/angularIF

View on GitHub
src/assets/primeng/components/tree/tree.js

Summary

Maintainability
F
2 wks
Test Coverage

Function Tree has a Cognitive Complexity of 260 (exceeds 5 allowed). Consider refactoring.
Open

var Tree = (function () {
    function Tree(dragDropService) {
        this.dragDropService = dragDropService;
        this.selectionChange = new core_1.EventEmitter();
        this.onNodeSelect = new core_1.EventEmitter();
Severity: Minor
Found in src/assets/primeng/components/tree/tree.js - About 5 days 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 Tree has 346 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Tree = (function () {
    function Tree(dragDropService) {
        this.dragDropService = dragDropService;
        this.selectionChange = new core_1.EventEmitter();
        this.onNodeSelect = new core_1.EventEmitter();
Severity: Major
Found in src/assets/primeng/components/tree/tree.js - About 1 day to fix

    File tree.js has 708 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    Severity: Major
    Found in src/assets/primeng/components/tree/tree.js - About 1 day to fix

      Function onNodeClick has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Tree.prototype.onNodeClick = function (event, node) {
              var eventTarget = event.target;
              if (eventTarget.className && eventTarget.className.indexOf('ui-tree-toggler') === 0) {
                  return;
              }
      Severity: Major
      Found in src/assets/primeng/components/tree/tree.js - About 3 hrs to fix

        Function __decorate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
            var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
            if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
            else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
            return c > 3 && r && Object.defineProperty(target, key, r), r;
        Severity: Minor
        Found in src/assets/primeng/components/tree/tree.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

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

            Tree.prototype.propagateUp = function (node, select) {
                if (node.children && node.children.length) {
                    var selectedCount = 0;
                    var childPartialSelected = false;
                    for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
        Severity: Minor
        Found in src/assets/primeng/components/tree/tree.js - About 1 hr to fix

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

              UITreeNode.prototype.onDropPoint = function (event, position) {
                  event.preventDefault();
                  var dragNode = this.tree.dragNode;
                  var dragNodeIndex = this.tree.dragNodeIndex;
                  var dragNodeScope = this.tree.dragNodeScope;
          Severity: Minor
          Found in src/assets/primeng/components/tree/tree.js - About 1 hr to fix

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

                Tree.prototype.isValidDragScope = function (dragScope) {
                    var dropScope = this.droppableScope;
                    if (dropScope) {
                        if (typeof dropScope === 'string') {
                            if (typeof dragScope === 'string')
            Severity: Minor
            Found in src/assets/primeng/components/tree/tree.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (this.isSingleSelectionMode()) {
                                          this.selectionChange.emit(null);
                                      }
                                      else {
                                          this.selection = this.selection.filter(function (val, i) { return i != index_1; });
              Severity: Major
              Found in src/assets/primeng/components/tree/tree.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (selected) {
                                            this.selection = null;
                                            this.onNodeUnselect.emit({ originalEvent: event, node: node });
                                        }
                                        else {
                Severity: Major
                Found in src/assets/primeng/components/tree/tree.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      for (var _i = 0, dropScope_1 = dropScope; _i < dropScope_1.length; _i++) {
                                          var s = dropScope_1[_i];
                                          for (var _a = 0, dragScope_1 = dragScope; _a < dragScope_1.length; _a++) {
                                              var ds = dragScope_1[_a];
                                              if (s === ds) {
                  Severity: Major
                  Found in src/assets/primeng/components/tree/tree.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (parent_1 === dragNode) {
                                                allow = false;
                                                break;
                                            }
                    Severity: Major
                    Found in src/assets/primeng/components/tree/tree.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (selected) {
                                                  this.selection = this.selection.filter(function (val, i) { return i != index_1; });
                                                  this.onNodeUnselect.emit({ originalEvent: event, node: node });
                                              }
                                              else {
                      Severity: Major
                      Found in src/assets/primeng/components/tree/tree.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (this.isSingleSelectionMode()) {
                                                    this.selectionChange.emit(node);
                                                }
                                                else if (this.isMultipleSelectionMode()) {
                                                    this.selection = (!metaKey) ? [] : this.selection || [];
                        Severity: Major
                        Found in src/assets/primeng/components/tree/tree.js - About 45 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return false;
                          Severity: Major
                          Found in src/assets/primeng/components/tree/tree.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return true;
                            Severity: Major
                            Found in src/assets/primeng/components/tree/tree.js - About 30 mins to fix

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

                                              if (metaSelection) {
                                                  var metaKey = (event.metaKey || event.ctrlKey);
                                                  if (selected && metaKey) {
                                                      if (this.isSingleSelectionMode()) {
                                                          this.selectionChange.emit(null);
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 3 days to fix
                              src/assets/primeng/components/treetable/treetable.js on lines 167..213

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

                              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

                                  Tree.prototype.propagateUp = function (node, select) {
                                      if (node.children && node.children.length) {
                                          var selectedCount = 0;
                                          var childPartialSelected = false;
                                          for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 2 days to fix
                              src/assets/primeng/components/treetable/treetable.js on lines 256..290

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

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

                              var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
                                  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
                                  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
                                  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
                                  return c > 3 && r && Object.defineProperty(target, key, r), r;
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 76 other locations - About 1 day to fix
                              src/assets/primeng/components/accordion/accordion.js on lines 2..7
                              src/assets/primeng/components/autocomplete/autocomplete.js on lines 2..7
                              src/assets/primeng/components/blockui/blockui.js on lines 2..7
                              src/assets/primeng/components/breadcrumb/breadcrumb.js on lines 2..7
                              src/assets/primeng/components/button/button.js on lines 2..7
                              src/assets/primeng/components/calendar/calendar.js on lines 2..7
                              src/assets/primeng/components/captcha/captcha.js on lines 2..7
                              src/assets/primeng/components/carousel/carousel.js on lines 2..7
                              src/assets/primeng/components/chart/chart.js on lines 2..7
                              src/assets/primeng/components/checkbox/checkbox.js on lines 2..7
                              src/assets/primeng/components/chips/chips.js on lines 2..7
                              src/assets/primeng/components/codehighlighter/codehighlighter.js on lines 2..7
                              src/assets/primeng/components/colorpicker/colorpicker.js on lines 2..7
                              src/assets/primeng/components/common/confirmationservice.js on lines 2..7
                              src/assets/primeng/components/common/messageservice.js on lines 2..7
                              src/assets/primeng/components/common/shared.js on lines 2..7
                              src/assets/primeng/components/common/treedragdropservice.js on lines 2..7
                              src/assets/primeng/components/confirmdialog/confirmdialog.js on lines 2..7
                              src/assets/primeng/components/contextmenu/contextmenu.js on lines 2..7
                              src/assets/primeng/components/datagrid/datagrid.js on lines 2..7
                              src/assets/primeng/components/datalist/datalist.js on lines 2..7
                              src/assets/primeng/components/datascroller/datascroller.js on lines 2..7
                              src/assets/primeng/components/datatable/datatable.js on lines 2..7
                              src/assets/primeng/components/defer/defer.js on lines 2..7
                              src/assets/primeng/components/dialog/dialog.js on lines 2..7
                              src/assets/primeng/components/dom/domhandler.js on lines 2..7
                              src/assets/primeng/components/dragdrop/dragdrop.js on lines 2..7
                              src/assets/primeng/components/dropdown/dropdown.js on lines 2..7
                              src/assets/primeng/components/editor/editor.js on lines 2..7
                              src/assets/primeng/components/fieldset/fieldset.js on lines 2..7
                              src/assets/primeng/components/fileupload/fileupload.js on lines 2..7
                              src/assets/primeng/components/galleria/galleria.js on lines 2..7
                              src/assets/primeng/components/gmap/gmap.js on lines 2..7
                              src/assets/primeng/components/growl/growl.js on lines 2..7
                              src/assets/primeng/components/inplace/inplace.js on lines 2..7
                              src/assets/primeng/components/inputmask/inputmask.js on lines 2..7
                              src/assets/primeng/components/inputswitch/inputswitch.js on lines 2..7
                              src/assets/primeng/components/inputtext/inputtext.js on lines 2..7
                              src/assets/primeng/components/inputtextarea/inputtextarea.js on lines 2..7
                              src/assets/primeng/components/lightbox/lightbox.js on lines 2..7
                              src/assets/primeng/components/listbox/listbox.js on lines 2..7
                              src/assets/primeng/components/megamenu/megamenu.js on lines 2..7
                              src/assets/primeng/components/menu/menu.js on lines 2..7
                              src/assets/primeng/components/menubar/menubar.js on lines 2..7
                              src/assets/primeng/components/messages/messages.js on lines 2..7
                              src/assets/primeng/components/multiselect/multiselect.js on lines 2..7
                              src/assets/primeng/components/orderlist/orderlist.js on lines 2..7
                              src/assets/primeng/components/organizationchart/organizationchart.js on lines 2..7
                              src/assets/primeng/components/overlaypanel/overlaypanel.js on lines 2..7
                              src/assets/primeng/components/paginator/paginator.js on lines 2..7
                              src/assets/primeng/components/panel/panel.js on lines 2..7
                              src/assets/primeng/components/panelmenu/panelmenu.js on lines 12..17
                              src/assets/primeng/components/password/password.js on lines 2..7
                              src/assets/primeng/components/picklist/picklist.js on lines 2..7
                              src/assets/primeng/components/progressbar/progressbar.js on lines 2..7
                              src/assets/primeng/components/radiobutton/radiobutton.js on lines 2..7
                              src/assets/primeng/components/rating/rating.js on lines 2..7
                              src/assets/primeng/components/schedule/schedule.js on lines 2..7
                              src/assets/primeng/components/selectbutton/selectbutton.js on lines 2..7
                              src/assets/primeng/components/sidebar/sidebar.js on lines 2..7
                              src/assets/primeng/components/slidemenu/slidemenu.js on lines 2..7
                              src/assets/primeng/components/slider/slider.js on lines 2..7
                              src/assets/primeng/components/spinner/spinner.js on lines 2..7
                              src/assets/primeng/components/splitbutton/splitbutton.js on lines 2..7
                              src/assets/primeng/components/steps/steps.js on lines 2..7
                              src/assets/primeng/components/tabmenu/tabmenu.js on lines 2..7
                              src/assets/primeng/components/tabview/tabview.js on lines 2..7
                              src/assets/primeng/components/terminal/terminal.js on lines 2..7
                              src/assets/primeng/components/terminal/terminalservice.js on lines 2..7
                              src/assets/primeng/components/tieredmenu/tieredmenu.js on lines 2..7
                              src/assets/primeng/components/togglebutton/togglebutton.js on lines 2..7
                              src/assets/primeng/components/toolbar/toolbar.js on lines 2..7
                              src/assets/primeng/components/tooltip/tooltip.js on lines 2..7
                              src/assets/primeng/components/treetable/treetable.js on lines 2..7
                              src/assets/primeng/components/tristatecheckbox/tristatecheckbox.js on lines 2..7
                              src/assets/primeng/components/utils/objectutils.js on lines 2..7

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

                              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

                                  Tree.prototype.propagateDown = function (node, select) {
                                      var index = this.findIndexInSelection(node);
                                      if (select && index == -1) {
                                          this.selection = (this.selection || []).concat([node]);
                                      }
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 1 day to fix
                              src/assets/primeng/components/treetable/treetable.js on lines 291..306

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

                              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

                                  Tree.prototype.findIndexInSelection = function (node) {
                                      var index = -1;
                                      if (this.selectionMode && this.selection) {
                                          if (this.isSingleSelectionMode()) {
                                              index = (this.selection == node) ? 0 : -1;
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 5 hrs to fix
                              src/assets/primeng/components/treetable/treetable.js on lines 239..255

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

                              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 TreeNodeTemplateLoader = (function () {
                                  function TreeNodeTemplateLoader(viewContainer) {
                                      this.viewContainer = viewContainer;
                                  }
                                  TreeNodeTemplateLoader.prototype.ngOnInit = function () {
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 4 hrs to fix
                              src/assets/primeng/components/organizationchart/organizationchart.js on lines 21..34

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

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

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

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

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

                              Refactorings

                              Further Reading

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

                                      if (this.node.expanded)
                                          this.tree.onNodeCollapse.emit({ originalEvent: event, node: this.node });
                                      else
                                          this.tree.onNodeExpand.emit({ originalEvent: event, node: this.node });
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 2 hrs to fix
                              src/assets/primeng/components/treetable/treetable.js on lines 31..34

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

                              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

                                  UITreeNode.prototype.isLeaf = function () {
                                      return this.node.leaf == false ? false : !(this.node.children && this.node.children.length);
                                  };
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 1 hr to fix
                              src/assets/primeng/components/treetable/treetable.js on lines 38..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 67.

                              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

                                  Tree.prototype.getTemplateForNode = function (node) {
                                      if (this.templateMap)
                                          return node.type ? this.templateMap[node.type] : this.templateMap['default'];
                                      else
                                          return null;
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 1 hr to fix
                              src/assets/primeng/components/organizationchart/organizationchart.js on lines 142..147

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

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

                              var __metadata = (this && this.__metadata) || function (k, v) {
                                  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
                              };
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 70 other locations - About 1 hr to fix
                              src/assets/primeng/components/accordion/accordion.js on lines 8..10
                              src/assets/primeng/components/autocomplete/autocomplete.js on lines 8..10
                              src/assets/primeng/components/blockui/blockui.js on lines 8..10
                              src/assets/primeng/components/breadcrumb/breadcrumb.js on lines 8..10
                              src/assets/primeng/components/button/button.js on lines 8..10
                              src/assets/primeng/components/calendar/calendar.js on lines 8..10
                              src/assets/primeng/components/captcha/captcha.js on lines 8..10
                              src/assets/primeng/components/carousel/carousel.js on lines 8..10
                              src/assets/primeng/components/chart/chart.js on lines 8..10
                              src/assets/primeng/components/checkbox/checkbox.js on lines 8..10
                              src/assets/primeng/components/chips/chips.js on lines 8..10
                              src/assets/primeng/components/codehighlighter/codehighlighter.js on lines 8..10
                              src/assets/primeng/components/colorpicker/colorpicker.js on lines 8..10
                              src/assets/primeng/components/common/shared.js on lines 8..10
                              src/assets/primeng/components/confirmdialog/confirmdialog.js on lines 8..10
                              src/assets/primeng/components/contextmenu/contextmenu.js on lines 8..10
                              src/assets/primeng/components/datagrid/datagrid.js on lines 8..10
                              src/assets/primeng/components/datalist/datalist.js on lines 8..10
                              src/assets/primeng/components/datascroller/datascroller.js on lines 8..10
                              src/assets/primeng/components/datatable/datatable.js on lines 8..10
                              src/assets/primeng/components/defer/defer.js on lines 8..10
                              src/assets/primeng/components/dialog/dialog.js on lines 8..10
                              src/assets/primeng/components/dragdrop/dragdrop.js on lines 8..10
                              src/assets/primeng/components/dropdown/dropdown.js on lines 8..10
                              src/assets/primeng/components/editor/editor.js on lines 8..10
                              src/assets/primeng/components/fieldset/fieldset.js on lines 8..10
                              src/assets/primeng/components/fileupload/fileupload.js on lines 8..10
                              src/assets/primeng/components/galleria/galleria.js on lines 8..10
                              src/assets/primeng/components/gmap/gmap.js on lines 8..10
                              src/assets/primeng/components/growl/growl.js on lines 8..10
                              src/assets/primeng/components/inplace/inplace.js on lines 8..10
                              src/assets/primeng/components/inputmask/inputmask.js on lines 8..10
                              src/assets/primeng/components/inputswitch/inputswitch.js on lines 8..10
                              src/assets/primeng/components/inputtext/inputtext.js on lines 8..10
                              src/assets/primeng/components/inputtextarea/inputtextarea.js on lines 8..10
                              src/assets/primeng/components/lightbox/lightbox.js on lines 8..10
                              src/assets/primeng/components/listbox/listbox.js on lines 8..10
                              src/assets/primeng/components/megamenu/megamenu.js on lines 8..10
                              src/assets/primeng/components/menu/menu.js on lines 8..10
                              src/assets/primeng/components/menubar/menubar.js on lines 8..10
                              src/assets/primeng/components/messages/messages.js on lines 8..10
                              src/assets/primeng/components/multiselect/multiselect.js on lines 8..10
                              src/assets/primeng/components/orderlist/orderlist.js on lines 8..10
                              src/assets/primeng/components/organizationchart/organizationchart.js on lines 8..10
                              src/assets/primeng/components/overlaypanel/overlaypanel.js on lines 8..10
                              src/assets/primeng/components/paginator/paginator.js on lines 8..10
                              src/assets/primeng/components/panel/panel.js on lines 8..10
                              src/assets/primeng/components/panelmenu/panelmenu.js on lines 18..20
                              src/assets/primeng/components/password/password.js on lines 8..10
                              src/assets/primeng/components/picklist/picklist.js on lines 8..10
                              src/assets/primeng/components/progressbar/progressbar.js on lines 8..10
                              src/assets/primeng/components/radiobutton/radiobutton.js on lines 8..10
                              src/assets/primeng/components/rating/rating.js on lines 8..10
                              src/assets/primeng/components/schedule/schedule.js on lines 8..10
                              src/assets/primeng/components/selectbutton/selectbutton.js on lines 8..10
                              src/assets/primeng/components/sidebar/sidebar.js on lines 8..10
                              src/assets/primeng/components/slidemenu/slidemenu.js on lines 8..10
                              src/assets/primeng/components/slider/slider.js on lines 8..10
                              src/assets/primeng/components/spinner/spinner.js on lines 8..10
                              src/assets/primeng/components/splitbutton/splitbutton.js on lines 8..10
                              src/assets/primeng/components/steps/steps.js on lines 8..10
                              src/assets/primeng/components/tabmenu/tabmenu.js on lines 8..10
                              src/assets/primeng/components/tabview/tabview.js on lines 8..10
                              src/assets/primeng/components/terminal/terminal.js on lines 8..10
                              src/assets/primeng/components/tieredmenu/tieredmenu.js on lines 8..10
                              src/assets/primeng/components/togglebutton/togglebutton.js on lines 8..10
                              src/assets/primeng/components/toolbar/toolbar.js on lines 8..10
                              src/assets/primeng/components/tooltip/tooltip.js on lines 8..10
                              src/assets/primeng/components/treetable/treetable.js on lines 8..10
                              src/assets/primeng/components/tristatecheckbox/tristatecheckbox.js on lines 8..10

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

                              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

                              Tree = __decorate([
                                  core_1.Component({
                                      selector: 'p-tree',
                                      template: "\n        <div [ngClass]=\"{'ui-tree ui-widget ui-widget-content ui-corner-all':true,'ui-tree-selectable':selectionMode,'ui-treenode-dragover':dragHover,'ui-tree-loading': loading}\" [ngStyle]=\"style\" [class]=\"styleClass\" *ngIf=\"!horizontal\"\n            (drop)=\"onDrop($event)\" (dragover)=\"onDragOver($event)\" (dragenter)=\"onDragEnter($event)\" (dragleave)=\"onDragLeave($event)\">\n            <div class=\"ui-tree-loading-mask ui-widget-overlay\" *ngIf=\"loading\"></div>\n            <div class=\"ui-tree-loading-content\" *ngIf=\"loading\">\n                <i [class]=\"'fa fa-spin fa-2x ' + loadingIcon\"></i>\n            </div>\n            <ul class=\"ui-tree-container\">\n                <p-treeNode *ngFor=\"let node of value;let firstChild=first;let lastChild=last; let index=index\" [node]=\"node\" \n                [firstChild]=\"firstChild\" [lastChild]=\"lastChild\" [index]=\"index\"></p-treeNode>\n            </ul>\n        </div>\n        <div [ngClass]=\"{'ui-tree ui-tree-horizontal ui-widget ui-widget-content ui-corner-all':true,'ui-tree-selectable':selectionMode}\"  [ngStyle]=\"style\" [class]=\"styleClass\" *ngIf=\"horizontal\">\n            <div class=\"ui-tree-loading ui-widget-overlay\" *ngIf=\"loading\"></div>\n            <div class=\"ui-tree-loading-content\" *ngIf=\"loading\">\n                <i [class]=\"'fa fa-spin fa-2x ' + loadingIcon\"></i>\n            </div>\n            <table *ngIf=\"value&&value[0]\">\n                <p-treeNode [node]=\"value[0]\" [root]=\"true\"></p-treeNode>\n            </table>\n        </div>\n    "
                                  }),
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 1 hr to fix
                              src/assets/primeng/components/messages/messages.js on lines 99..106

                              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

                              TreeModule = __decorate([
                                  core_1.NgModule({
                                      imports: [common_1.CommonModule],
                                      exports: [Tree, shared_1.SharedModule],
                                      declarations: [Tree, UITreeNode, TreeNodeTemplateLoader]
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 1 other location - About 1 hr to fix
                              src/assets/primeng/components/organizationchart/organizationchart.js on lines 254..260

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

                              var __param = (this && this.__param) || function (paramIndex, decorator) {
                                  return function (target, key) { decorator(target, key, paramIndex); }
                              };
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 8 other locations - About 30 mins to fix
                              src/assets/primeng/components/contextmenu/contextmenu.js on lines 11..13
                              src/assets/primeng/components/datatable/datatable.js on lines 11..13
                              src/assets/primeng/components/growl/growl.js on lines 11..13
                              src/assets/primeng/components/menu/menu.js on lines 11..13
                              src/assets/primeng/components/messages/messages.js on lines 11..13
                              src/assets/primeng/components/organizationchart/organizationchart.js on lines 11..13
                              src/assets/primeng/components/slidemenu/slidemenu.js on lines 11..13
                              src/assets/primeng/components/treetable/treetable.js on lines 11..13

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

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

                              TreeNodeTemplateLoader = __decorate([
                                  core_1.Component({
                                      selector: 'p-treeNodeTemplateLoader',
                                      template: ""
                                  }),
                              Severity: Major
                              Found in src/assets/primeng/components/tree/tree.js and 12 other locations - About 30 mins to fix
                              src/assets/primeng/components/accordion/accordion.js on lines 81..87
                              src/assets/primeng/components/chart/chart.js on lines 106..112
                              src/assets/primeng/components/common/shared.js on lines 325..331
                              src/assets/primeng/components/common/shared.js on lines 351..357
                              src/assets/primeng/components/common/shared.js on lines 377..383
                              src/assets/primeng/components/common/shared.js on lines 403..409
                              src/assets/primeng/components/common/shared.js on lines 439..445
                              src/assets/primeng/components/common/shared.js on lines 472..478
                              src/assets/primeng/components/datatable/datatable.js on lines 104..110
                              src/assets/primeng/components/organizationchart/organizationchart.js on lines 43..49
                              src/assets/primeng/components/tabview/tabview.js on lines 147..153
                              src/assets/primeng/components/tabview/tabview.js on lines 317..323

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

                              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