modxcms/revolution

View on GitHub
manager/assets/modext/widgets/core/modx.combo.js

Summary

Maintainability
F
1 wk
Test Coverage

File modx.combo.js has 1012 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Ext.namespace('MODx.combo');
/* disable shadows for the combo-list globally, saves a few dom nodes as it's not used anyways */
Ext.form.ComboBox.prototype.shadow = false;
/* replaces the default img tag for the combo trigger with a div to make the use of iconfonts with :before possible */
Ext.override(Ext.form.TriggerField, {
Severity: Major
Found in manager/assets/modext/widgets/core/modx.combo.js - About 2 days to fix

    Function ComboBox has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    MODx.combo.ComboBox = function(config,getStore) {
        config = config || {};
        Ext.applyIf(config,{
            displayField: 'name'
            ,valueField: 'id'
    Severity: Major
    Found in manager/assets/modext/widgets/core/modx.combo.js - About 2 hrs to fix

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

          expand : function(){
              if(this.isExpanded() || !this.hasFocus){
                  return;
              }
      
      
      Severity: Minor
      Found in manager/assets/modext/widgets/core/modx.combo.js - About 1 hr to fix

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

            expand : function(){
                if(this.isExpanded() || !this.hasFocus){
                    return;
                }
        
        
        Severity: Minor
        Found in manager/assets/modext/widgets/core/modx.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 onTriggerClick has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ,onTriggerClick: function() {
                if (this.disabled) { return false; }
                if (this.oldValue) {
                    this.fireEvent('end',{
                        v: this.oldValue
        Severity: Minor
        Found in manager/assets/modext/widgets/core/modx.combo.js - About 1 hr to fix

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

              ,handleChangeParent: function(node,e) {
                  var t = Ext.getCmp('modx-resource-tree');
                  if (!t) { return false; }
                  t.disableHref = true;
          
          
          Severity: Minor
          Found in manager/assets/modext/widgets/core/modx.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.disabled) { return false; }
                  if (this.oldValue) {
                      this.fireEvent('end',{
                          v: this.oldValue
          Severity: Minor
          Found in manager/assets/modext/widgets/core/modx.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

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

          Ext.util.Format.comboRenderer = function (combo,val) {
              return function (v,md,rec,ri,ci,s) {
                  if (!s) return v;
                  if (!combo.findRecord) return v;
                  var record = combo.findRecord(combo.valueField, v);
          Severity: Minor
          Found in manager/assets/modext/widgets/core/modx.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

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

              preselectFirstValue: function(r) {
                  var item;
          
                  if (this.config.preselectValue == '') {
                      item = r.getAt(0);
          Severity: Minor
          Found in manager/assets/modext/widgets/core/modx.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

          MODx.combo.Dashboard = function(config) {
              config = config || {};
              Ext.applyIf(config,{
                  name: 'dashboard'
                  ,hiddenName: 'dashboard'
          Severity: Major
          Found in manager/assets/modext/widgets/core/modx.combo.js and 1 other location - About 5 hrs to fix
          manager/assets/modext/widgets/core/modx.combo.js on lines 999..1020

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

          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

          MODx.combo.MediaSource = function(config) {
              config = config || {};
              Ext.applyIf(config,{
                  name: 'source'
                  ,hiddenName: 'source'
          Severity: Major
          Found in manager/assets/modext/widgets/core/modx.combo.js and 1 other location - About 5 hrs to fix
          manager/assets/modext/widgets/core/modx.combo.js on lines 974..995

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

          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

          MODx.combo.Role = function(config) {
              config = config || {};
              Ext.applyIf(config,{
                  name: 'role'
                  ,hiddenName: 'role'
          Severity: Major
          Found in manager/assets/modext/widgets/core/modx.combo.js and 1 other location - About 5 hrs to fix
          manager/assets/modext/widgets/core/modx.combo.js on lines 1050..1068

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

          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

          MODx.combo.Authority = function(config) {
              config = config || {};
              Ext.applyIf(config,{
                  name: 'authority'
                  ,hiddenName: 'authority'
          Severity: Major
          Found in manager/assets/modext/widgets/core/modx.combo.js and 1 other location - About 5 hrs to fix
          manager/assets/modext/widgets/core/modx.combo.js on lines 511..529

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

          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

          MODx.combo.ResourceGroup = function(config) {
              config = config || {};
              Ext.applyIf(config,{
                  name: 'resourcegroup'
                  ,hiddenName: 'resourcegroup'
          Severity: Major
          Found in manager/assets/modext/widgets/core/modx.combo.js and 1 other location - About 4 hrs to fix
          manager/assets/modext/widgets/core/modx.combo.js on lines 284..299

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

          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

          MODx.combo.UserGroupRole = function(config) {
              config = config || {};
              Ext.applyIf(config,{
                  name: 'role'
                  ,hiddenName: 'role'
          Severity: Major
          Found in manager/assets/modext/widgets/core/modx.combo.js and 1 other location - About 4 hrs to fix
          manager/assets/modext/widgets/core/modx.combo.js on lines 323..338

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 131.

          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

                  store: new Ext.data.SimpleStore({
                      fields: ['d','v']
                      ,data: [[_('yes'),true],[_('no'),false]]
                  })
          Severity: Minor
          Found in manager/assets/modext/widgets/core/modx.combo.js and 1 other location - About 40 mins to fix
          manager/assets/modext/widgets/core/modx.grid.js on lines 475..478

          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