modxcms/revolution

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

Summary

Maintainability
F
6 days
Test Coverage

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

Ext.namespace('MODx.panel');

MODx.Panel = function(config) {
    config = config || {};
    Ext.applyIf(config,{
Severity: Major
Found in manager/assets/modext/widgets/core/modx.panel.js - About 1 day to fix

    Function showErroredTab has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        ,showErroredTab: function(targetForms, tabsId) {
    
            var mainTabs = Ext.getCmp(tabsId);
            var searchTabs = this.getTabIdsFromKeys(mainTabs.items.map, targetForms),
                mainTabName = null,
    Severity: Minor
    Found in manager/assets/modext/widgets/core/modx.panel.js - About 4 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 submit has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        ,submit: function(o) {
            var fm = this.getForm();
            if (fm.isValid() || o.bypassValidCheck) {
                o = o || {};
                o.headers = {
    Severity: Minor
    Found in manager/assets/modext/widgets/core/modx.panel.js - About 3 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 addChangeEvent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        ,addChangeEvent: function(items) {
            if (!items) { return false; }
            if (typeof(items) == 'object' && items.items) {
                items = items.items;
            }
    Severity: Minor
    Found in manager/assets/modext/widgets/core/modx.panel.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 submit has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ,submit: function(o) {
            var fm = this.getForm();
            if (fm.isValid() || o.bypassValidCheck) {
                o = o || {};
                o.headers = {
    Severity: Major
    Found in manager/assets/modext/widgets/core/modx.panel.js - About 2 hrs to fix

      Function showErroredTab has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ,showErroredTab: function(targetForms, tabsId) {
      
              var mainTabs = Ext.getCmp(tabsId);
              var searchTabs = this.getTabIdsFromKeys(mainTabs.items.map, targetForms),
                  mainTabName = null,
      Severity: Minor
      Found in manager/assets/modext/widgets/core/modx.panel.js - About 1 hr to fix

        Function FormPanel has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        MODx.FormPanel = function(config) {
            config = config || {};
            Ext.applyIf(config,{
                autoHeight: true
                ,collapsible: true
        Severity: Minor
        Found in manager/assets/modext/widgets/core/modx.panel.js - About 1 hr to fix

          Function addChangeEvent has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              ,addChangeEvent: function(items) {
                  if (!items) { return false; }
                  if (typeof(items) == 'object' && items.items) {
                      items = items.items;
                  }
          Severity: Minor
          Found in manager/assets/modext/widgets/core/modx.panel.js - About 1 hr to fix

            Function Wizard has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            MODx.panel.Wizard = function(config) {
                config = config || {};
                Ext.applyIf(config,{
                    layout: 'card'
                    ,activeItem: 0
            Severity: Minor
            Found in manager/assets/modext/widgets/core/modx.panel.js - About 1 hr to fix

              Function BreadcrumbsPanel has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              MODx.BreadcrumbsPanel = function(config) {
                  config = config || {};
                  Ext.applyIf(config,{
                      frame:false
                      ,plain:true
              Severity: Minor
              Found in manager/assets/modext/widgets/core/modx.panel.js - About 1 hr to fix

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

                    ,onClick: function(e){
                        var target = e.getTarget();
                
                        var index = 1;
                        var parent = target.parentElement;
                Severity: Minor
                Found in manager/assets/modext/widgets/core/modx.panel.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 onClick has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    ,onClick: function(e){
                        var target = e.getTarget();
                
                        var index = 1;
                        var parent = target.parentElement;
                Severity: Minor
                Found in manager/assets/modext/widgets/core/modx.panel.js - About 1 hr to fix

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

                      ,setLabel: function(flds,vals,bp){
                          if (!Ext.isArray(flds)) { flds = flds[flds]; }
                          if (!Ext.isArray(vals)) { vals = valss[vals]; }
                          var f,v;
                          for (var i=0;i<flds.length;i++) {
                  Severity: Minor
                  Found in manager/assets/modext/widgets/core/modx.panel.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

                  Consider simplifying this complex logical expression.
                  Open

                          if (fld.isXType('combo') || fld.isXType('checkbox') || fld.isXType('radio') || fld.isXType('displayfield') || fld.isXType('statictextfield') || fld.isXType('hidden')) {
                              i = i+1;
                              fld = this.findFirstTextField(i);
                          }
                  Severity: Major
                  Found in manager/assets/modext/widgets/core/modx.panel.js - About 40 mins to fix

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

                        ,showField: function(flds) {
                            if (!Ext.isArray(flds)) { flds = flds[flds]; }
                            var f;
                            for (var i=0;i<flds.length;i++) {
                                f = this.getField(flds[i]);
                    Severity: Minor
                    Found in manager/assets/modext/widgets/core/modx.panel.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 hideField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        ,hideField: function(flds) {
                            if (!Ext.isArray(flds)) { flds = flds[flds]; }
                            var f;
                            for (var i=0;i<flds.length;i++) {
                                f = this.getField(flds[i]);
                    Severity: Minor
                    Found in manager/assets/modext/widgets/core/modx.panel.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

                        ,_updatePanel: function(data){
                            this.body.hide();
                            this.tpl.overwrite(this.body, data);
                            this.body.slideIn('r', {stopFx:true, duration:.2});
                            setTimeout(function(){
                    Severity: Major
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 3 hrs to fix
                    manager/assets/modext/widgets/core/modx.panel.js on lines 559..566

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

                    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

                        ,updateDetail: function(data) {
                            this.body.hide();
                            this.tpl.overwrite(this.body, data);
                            this.body.slideIn('r', {stopFx:true, duration:.2});
                            setTimeout(function(){
                    Severity: Major
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 3 hrs to fix
                    manager/assets/modext/widgets/core/modx.panel.js on lines 696..703

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

                    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

                            if (fld.isXType('combo') || fld.isXType('checkbox') || fld.isXType('radio') || fld.isXType('displayfield') || fld.isXType('statictextfield') || fld.isXType('hidden')) {
                                i = i+1;
                                fld = this.findFirstTextField(i);
                            }
                    Severity: Major
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 3 hrs to fix
                    manager/assets/modext/widgets/core/modx.window.js on lines 226..229

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

                    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 (id == this.config.firstPanel) {
                                this.getBottomToolbar().items.item(0).setDisabled(true);
                                this.getBottomToolbar().items.item(1).setText(this.config.txtNext);
                            } else if (id == this.config.lastPanel) {
                    Severity: Major
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 1 hr to fix
                    manager/assets/modext/widgets/core/modx.panel.js on lines 493..496

                    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

                            } else {
                                this.getBottomToolbar().items.item(0).setDisabled(false);
                                this.getBottomToolbar().items.item(1).setText(this.config.txtNext);
                            }
                    Severity: Major
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 1 hr to fix
                    manager/assets/modext/widgets/core/modx.panel.js on lines 488..491

                    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

                            ,bdMarkup: '<tpl if="typeof(trail) != &quot;undefined&quot;">'
                                +'<div class="crumb_wrapper"><ul class="crumbs">'
                                    +'<tpl for="trail">'
                                        +'<li{[values.className != undefined ? \' class="\'+values.className+\'"\' : \'\' ]}>'
                                            +'<tpl if="typeof pnl != \'undefined\'">'
                    Severity: Major
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 1 hr to fix
                    _build/templates/default/gruntfile.js on lines 37..54

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

                    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

                        ,clearDirty: function() {
                            var f = this.config.onDirtyForm ? Ext.getCmp(this.config.onDirtyForm) : this.getForm();
                            return f.clearDirty();
                        }
                    Severity: Major
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 1 hr to fix
                    manager/assets/modext/widgets/core/modx.panel.js on lines 220..223

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

                    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

                        ,isDirty: function() {
                            var f = this.config.onDirtyForm ? Ext.getCmp(this.config.onDirtyForm) : this.getForm();
                            return f.isDirty();
                        }
                    Severity: Major
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 1 hr to fix
                    manager/assets/modext/widgets/core/modx.panel.js on lines 225..228

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

                    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.config.success) {
                                                Ext.callback(this.config.success,this.config.scope || this,[f,a]);
                                            }
                    Severity: Minor
                    Found in manager/assets/modext/widgets/core/modx.panel.js and 1 other location - About 50 mins to fix
                    manager/assets/modext/widgets/core/modx.window.js on lines 248..250

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

                    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