talho/openphin

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

Summary

Maintainability
F
5 days
Test Coverage

File Component.js has 572 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: Major
Found in app/assets/javascripts/ext/src/widgets/Component.js - About 1 day to fix

    `` has 57 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ext.extend(Ext.Component, Ext.util.Observable, {
        // Configs below are used for all Components when rendered by FormLayout.
        /**
         * @cfg {String} fieldLabel <p>The label text to display next to this Component (defaults to '').</p>
         * <br><p><b>Note</b>: this config is only used when this Component is rendered by a Container which
    Severity: Major
    Found in app/assets/javascripts/ext/src/widgets/Component.js - About 1 day to fix

      Function render has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          render : function(container, position){
              if(!this.rendered && this.fireEvent('beforerender', this) !== false){
                  if(!container && this.el){
                      this.el = Ext.get(this.el);
                      container = this.el.dom.parentNode;
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/Component.js - About 5 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 render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          render : function(container, position){
              if(!this.rendered && this.fireEvent('beforerender', this) !== false){
                  if(!container && this.el){
                      this.el = Ext.get(this.el);
                      container = this.el.dom.parentNode;
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/Component.js - About 2 hrs to fix

        Function destroy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            destroy : function(){
                if(!this.isDestroyed){
                    if(this.fireEvent('beforedestroy', this) !== false){
                        this.destroying = true;
                        this.beforeDestroy();
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/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

        Function Component has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        Ext.Component = function(config){
            config = config || {};
            if(config.initialConfig){
                if(config.isAction){           // actions
                    this.baseAction = config;
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/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

        Function Component has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Ext.Component = function(config){
            config = config || {};
            if(config.initialConfig){
                if(config.isAction){           // actions
                    this.baseAction = config;
        Severity: Major
        Found in app/assets/javascripts/ext/src/widgets/Component.js - About 2 hrs to fix

          Function onRender has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              onRender : function(ct, position){
                  if(!this.el && this.autoEl){
                      if(Ext.isString(this.autoEl)){
                          this.el = document.createElement(this.autoEl);
                      }else{
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/Component.js - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function mon has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              mon : function(item, ename, fn, scope, opt){
                  this.createMons();
                  if(Ext.isObject(ename)){
                      var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
          
          
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/Component.js - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function initState has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              initState : function(){
                  if(Ext.state.Manager){
                      var id = this.getStateId();
                      if(id){
                          var state = Ext.state.Manager.get(id);
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/Component.js - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function mon has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              mon : function(item, ename, fn, scope, opt){
                  this.createMons();
                  if(Ext.isObject(ename)){
                      var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
          
          
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/Component.js - About 1 hr to fix

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

                show : function(){
                    if(this.fireEvent('beforeshow', this) !== false){
                        this.hidden = false;
                        if(this.autoRender){
                            this.render(Ext.isBoolean(this.autoRender) ? Ext.getBody() : this.autoRender);
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Component.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

            Function mon has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                mon : function(item, ename, fn, scope, opt){
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/Component.js - About 35 mins to fix

              Function saveState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  saveState : function(){
                      if(Ext.state.Manager && this.stateful !== false){
                          var id = this.getStateId();
                          if(id){
                              var state = this.getState();
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js - About 35 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

              Function focus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  focus : function(selectText, delay){
                      if(delay){
                          this.focusTask = new Ext.util.DelayedTask(this.focus, this, [selectText, false]);
                          this.focusTask.delay(Ext.isNumber(delay) ? delay : 10);
                          return this;
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js - About 35 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

              Function initRef has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  initRef : function() {
                      /**
                       * @cfg {String} ref
                       * <p>A path specification, relative to the Component's <code>{@link #ownerCt}</code>
                       * specifying into which ancestor Container to place a named reference to this Component.</p>
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js - About 25 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

              Function update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  update: function(htmlOrData, loadScripts, cb) {
                      var contentTarget = this.getContentTarget();
                      if (this.tpl && typeof htmlOrData !== "string") {
                          this.tpl[this.tplWriteMode](contentTarget, htmlOrData || {});
                      } else {
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js - About 25 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

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

                  onDisable : function(){
                      this.getActionEl().addClass(this.disabledClass);
                      this.el.dom.disabled = true;
                  },
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/ext/src/widgets/Component.js on lines 1435..1438

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 53.

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

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

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

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

              Refactorings

              Further Reading

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

                  onEnable : function(){
                      this.getActionEl().removeClass(this.disabledClass);
                      this.el.dom.disabled = false;
                  },
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/ext/src/widgets/Component.js on lines 1416..1419

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 53.

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

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

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

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

              Refactorings

              Further Reading

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

                      while(p){
                          if(fn.apply(scope || p, args || [p]) === false){
                              break;
                          }
                          p = p.ownerCt;
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js and 1 other location - About 40 mins to fix
              app/assets/javascripts/ext/src/data/Tree.js on lines 697..702

              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

                                  this.mons.push({
                                      item: item, ename: e, fn: o[e], scope: o.scope
                                  });
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/ext/src/widgets/Component.js on lines 1725..1727

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

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

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

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

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

              Refactorings

              Further Reading

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

                                  this.mons.push({
                                      item: item, ename: e, fn: o[e], scope: o.scope
                                  });
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/ext/src/widgets/Component.js on lines 1719..1721

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

              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(item === mon.item && ename == mon.ename && fn === mon.fn && scope === mon.scope){
                              this.mons.splice(i, 1);
                              item.un(ename, fn, scope);
                              found = true;
                              break;
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/Component.js and 1 other location - About 35 mins to fix
              app/assets/javascripts/ext/src/widgets/PagingToolbar.js on lines 402..414

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

              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