talho/openphin

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

Summary

Maintainability
F
6 days
Test Coverage

File Combo.js has 690 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/form/Combo.js - About 1 day to fix

    ComboBox has 47 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, {
        /**
         * @cfg {Mixed} transform The id, DOM node or element of an existing HTML SELECT to convert to a ComboBox.
         * Note that if you specify this and the combo is going to be in an {@link Ext.form.BasicForm} or
         * {@link Ext.form.FormPanel}, you must also set <tt>{@link #lazyRender} = true</tt>.
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 6 hrs to fix

      Function initComponent has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          initComponent : function(){
              Ext.form.ComboBox.superclass.initComponent.call(this);
              this.addEvents(
                  /**
                   * @event expand
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/Combo.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 bindStore has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          bindStore : function(store, initial){
              if(this.store && !initial){
                  if(this.store !== store && this.store.autoDestroy){
                      this.store.destroy();
                  }else{
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/Combo.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 onLoad has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          onLoad : function(){
              if(!this.hasFocus){
                  return;
              }
              if(this.store.getCount() > 0 || this.listEmptyText){
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/form/Combo.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 initList has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          initList : function(){
              if(!this.list){
                  var cls = 'x-combo-list',
                      listParent = Ext.getDom(this.getListParent() || Ext.getBody());
      
      
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 2 hrs to fix

        Function initComponent has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            initComponent : function(){
                Ext.form.ComboBox.superclass.initComponent.call(this);
                this.addEvents(
                    /**
                     * @event expand
        Severity: Major
        Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 2 hrs to fix

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

              initEvents : function(){
                  Ext.form.ComboBox.superclass.initEvents.call(this);
          
                  /**
                   * @property keyNav
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/form/Combo.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 initEvents has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              initEvents : function(){
                  Ext.form.ComboBox.superclass.initEvents.call(this);
          
                  /**
                   * @property keyNav
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 2 hrs to fix

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

                doQuery : function(q, forceAll){
                    q = Ext.isEmpty(q) ? '' : q;
                    var qe = {
                        query: q,
                        forceAll: forceAll,
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/form/Combo.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 initList has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                initList : function(){
                    if(!this.list){
                        var cls = 'x-combo-list',
                            listParent = Ext.getDom(this.getListParent() || Ext.getBody());
            
            
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/form/Combo.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 bindStore has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                bindStore : function(store, initial){
                    if(this.store && !initial){
                        if(this.store !== store && this.store.autoDestroy){
                            this.store.destroy();
                        }else{
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 1 hr to fix

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

                  assertValue  : function(){
                      var val = this.getRawValue(),
                          rec = this.findRecord(this.displayField, val);
              
                      if(!rec && this.forceSelection){
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/form/Combo.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 doQuery has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  doQuery : function(q, forceAll){
                      q = Ext.isEmpty(q) ? '' : q;
                      var qe = {
                          query: q,
                          forceAll: forceAll,
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 1 hr to fix

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

                    expand : function(){
                        if(this.isExpanded() || !this.hasFocus){
                            return;
                        }
                
                
                Severity: Minor
                Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 1 hr to fix

                  Function expand has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      expand : function(){
                          if(this.isExpanded() || !this.hasFocus){
                              return;
                          }
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/ext/src/widgets/form/Combo.js - About 55 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 onRender has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      onRender : function(ct, position){
                          if(this.hiddenName && !Ext.isDefined(this.submitValue)){
                              this.submitValue = false;
                          }
                          Ext.form.ComboBox.superclass.onRender.call(this, ct, position);
                  Severity: Minor
                  Found in app/assets/javascripts/ext/src/widgets/form/Combo.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 onTriggerClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      onTriggerClick : function(){
                          if(this.readOnly || this.disabled){
                              return;
                          }
                          if(this.isExpanded()){
                  Severity: Minor
                  Found in app/assets/javascripts/ext/src/widgets/form/Combo.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

                              if(this.store !== store && this.store.autoDestroy){
                                  this.store.destroy();
                              }else{
                                  this.store.un('beforeload', this.onBeforeLoad, this);
                                  this.store.un('load', this.onLoad, this);
                  Severity: Major
                  Found in app/assets/javascripts/ext/src/widgets/form/Combo.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/ext/src/widgets/PagingToolbar.js on lines 486..492

                  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

                      onEnable : function(){
                          Ext.form.ComboBox.superclass.onEnable.apply(this, arguments);
                          if(this.hiddenField){
                              this.hiddenField.disabled = false;
                          }
                  Severity: Major
                  Found in app/assets/javascripts/ext/src/widgets/form/Combo.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/ext/src/widgets/form/Combo.js on lines 875..880

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

                      onDisable : function(){
                          Ext.form.ComboBox.superclass.onDisable.apply(this, arguments);
                          if(this.hiddenField){
                              this.hiddenField.disabled = true;
                          }
                  Severity: Major
                  Found in app/assets/javascripts/ext/src/widgets/form/Combo.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/ext/src/widgets/form/Combo.js on lines 867..872

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

                              this.store.on({
                                  scope: this,
                                  beforeload: this.onBeforeLoad,
                                  load: this.onLoad,
                                  exception: this.collapse
                  Severity: Major
                  Found in app/assets/javascripts/ext/src/widgets/form/Combo.js and 3 other locations - About 40 mins to fix
                  app/assets/javascripts/ext/src/widgets/LoadMask.js on lines 28..33
                  app/assets/javascripts/ext/src/widgets/form/CompositeField.js on lines 119..124
                  app/assets/javascripts/ext/src/widgets/grid/GridView.js on lines 931..936

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

                  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