talho/openphin

View on GitHub
app/assets/javascripts/ext/src/widgets/tree/TreeNode.js

Summary

Maintainability
F
4 days
Test Coverage

TreeNode has 38 functions (exceeds 20 allowed). Consider refactoring.
Open

Ext.tree.TreeNode = Ext.extend(Ext.data.Node, {
    
    constructor : function(attributes){
        attributes = attributes || {};
        if(Ext.isString(attributes)){
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js - About 5 hrs to fix

    File TreeNode.js has 350 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * Ext JS Library 3.3.0
     * Copyright(c) 2006-2010 Ext JS, Inc.
     * licensing@extjs.com
     * http://www.extjs.com/license
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js - About 4 hrs to fix

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

          collapse : function(deep, anim, callback, scope){
              if(this.expanded && !this.isHiddenRoot()){
                  if(this.fireEvent('beforecollapse', this, deep, anim) === false){
                      return;
                  }
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.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 expand has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          expand : function(deep, anim, callback, scope){
              if(!this.expanded){
                  if(this.fireEvent('beforeexpand', this, deep, anim) === false){
                      return;
                  }
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.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 constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          constructor : function(attributes){
              attributes = attributes || {};
              if(Ext.isString(attributes)){
                  attributes = {text: attributes};
              }
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js - About 1 hr to fix

        Function expand has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            expand : function(deep, anim, callback, scope){
                if(!this.expanded){
                    if(this.fireEvent('beforeexpand', this, deep, anim) === false){
                        return;
                    }
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js - About 1 hr to fix

          Function collapse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              collapse : function(deep, anim, callback, scope){
                  if(this.expanded && !this.isHiddenRoot()){
                      if(this.fireEvent('beforecollapse', this, deep, anim) === false){
                          return;
                      }
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js - About 1 hr to fix

            Function removeChild has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                removeChild : function(node, destroy){
                    this.ownerTree.getSelectionModel().unselect(node);
                    Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments);
                    // only update the ui if we're not destroying
                    if(!destroy){
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js - About 45 mins 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

            Consider simplifying this complex logical expression.
            Open

                        if(!this.isHiddenRoot() && (this.getOwnerTree().animate && anim !== false) || anim){
                            this.ui.animExpand(function(){
                                this.fireEvent('expand', this);
                                this.runCallback(callback, scope || this, [this]);
                                if(deep === true){
            Severity: Major
            Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js - About 40 mins to fix

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

                  setLastChild : function(node){
                      var ol = this.lastChild;
                      Ext.tree.TreeNode.superclass.setLastChild.call(this, node);
                      if(this.childrenRendered && ol && node != ol){
                          ol.renderIndent(true, true);
              Severity: Major
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 195..204

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 110.

              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

                  setFirstChild : function(node){
                      var of = this.firstChild;
                      Ext.tree.TreeNode.superclass.setFirstChild.call(this, node);
                      if(this.childrenRendered && of && node != of){
                          of.renderIndent(true, true);
              Severity: Major
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 207..216

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

              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

                  setTooltip : function(tip, title){
                      this.attributes.qtip = tip;
                      this.attributes.qtipTitle = title;
                      if(this.rendered){
                          this.ui.onTipChange(this, tip, title);
              Severity: Major
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 322..328

              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

                  setHref : function(href, target){
                      this.attributes.href = href;
                      this.attributes.hrefTarget = target;
                      if(this.rendered){
                          this.ui.onHrefChange(this, href, target);
              Severity: Major
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 298..304

              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

                  setCls : function(cls){
                      var old = this.attributes.cls;
                      this.attributes.cls = cls;
                      if(this.rendered){
                          this.ui.onClsChange(this, cls, old);
              Severity: Major
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 285..291

              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

                  setIconCls : function(cls){
                      var old = this.attributes.iconCls;
                      this.attributes.iconCls = cls;
                      if(this.rendered){
                          this.ui.onIconClsChange(this, cls, old);
              Severity: Major
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 334..340

              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

                          if((this.getOwnerTree().animate && anim !== false) || anim){
                              this.ui.animCollapse(function(){
                                  this.fireEvent('collapse', this);
                                  this.runCallback(callback, scope || this, [this]);
                                  if(deep === true){
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 40 mins to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 390..403

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

              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.isHiddenRoot() && (this.getOwnerTree().animate && anim !== false) || anim){
                              this.ui.animExpand(function(){
                                  this.fireEvent('expand', this);
                                  this.runCallback(callback, scope || this, [this]);
                                  if(deep === true){
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 40 mins to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 437..450

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

              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

                      for(var i = 0, len = cs.length; i < len; i++){
                          cs[i].render(true);
                      }
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 567..569

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

              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

                          for(var i = 0, len = cs.length; i < len; i++){
                              cs[i].render(true);
                          }
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/tree/TreeNode.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/ext/src/widgets/tree/TreeNode.js on lines 556..558

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

              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