modxcms/revolution

View on GitHub
manager/assets/modext/widgets/resource/modx.tree.resource.js

Summary

Maintainability
F
2 wks
Test Coverage

File modx.tree.resource.js has 1206 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Generates the Resource Tree in Ext
 *
 * @class MODx.tree.Resource
 * @extends MODx.tree.Tree
Severity: Major
Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 3 days to fix

    Function getQRSettings has 211 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    MODx.getQRSettings = function(id,va) {
        id = id || 'qur';
        return [{
            layout: 'column'
            ,border: false
    Severity: Major
    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 1 day to fix

      Function QuickCreateResource has 152 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      MODx.window.QuickCreateResource = function(config) {
          config = config || {};
          this.ident = config.ident || 'qcr'+Ext.id();
          Ext.applyIf(config,{
              title: _('quick_create_resource')
      Severity: Major
      Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 6 hrs to fix

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

        Ext.extend(MODx.tree.Resource,MODx.tree.Tree,{
            forms: {}
            ,windows: {}
            ,stores: {}
        
        
        Severity: Minor
        Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 4 hrs to fix

          Function _getModResourceMenu has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              ,_getModResourceMenu: function(n) {
                  var a = n.attributes;
                  var ui = n.getUI();
                  var m = [];
                  m.push({
          Severity: Major
          Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 3 hrs to fix

            Function getQRSettings has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            MODx.getQRSettings = function(id,va) {
                id = id || 'qur';
                return [{
                    layout: 'column'
                    ,border: false
            Severity: Minor
            Found in manager/assets/modext/widgets/resource/modx.tree.resource.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 _initExpand has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                ,_initExpand: function() {
                    var treeState = Ext.state.Manager.get(this.treestate_id);
                    if ((Ext.isString(treeState) || Ext.isEmpty(treeState)) && this.root) {
                        if (this.root) {this.root.expand();}
                        var wn = this.getNodeById('web_0');
            Severity: Minor
            Found in manager/assets/modext/widgets/resource/modx.tree.resource.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 getQRContentField has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            MODx.getQRContentField = function(id,cls) {
                id = id || 'qur';
                cls = cls || 'modDocument';
                var dm = Ext.getBody().getViewSize();
                var o = {};
            Severity: Major
            Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 2 hrs to fix

              Function _getSortMenu has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  ,_getSortMenu: function(){
                      return [{
                          text: _('sort_by')
                          ,handler: function() {return false;}
                          ,menu: {
              Severity: Major
              Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 2 hrs to fix

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

                    ,_getModResourceMenu: function(n) {
                        var a = n.attributes;
                        var ui = n.getUI();
                        var m = [];
                        m.push({
                Severity: Minor
                Found in manager/assets/modext/widgets/resource/modx.tree.resource.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 _getModContextMenu has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    ,_getModContextMenu: function(n) {
                        var a = n.attributes;
                        var ui = n.getUI();
                        var m = [];
                
                
                Severity: Minor
                Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 1 hr to fix

                  Function _getCreateMenus has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      ,_getCreateMenus: function(m,pk,ui) {
                          var types = MODx.config.resource_classes;
                          var o = this.fireEvent('loadCreateMenus',types);
                          if (Ext.isObject(o)) {
                              Ext.apply(types,o);
                  Severity: Minor
                  Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 1 hr to fix

                    Function quickCreate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        ,quickCreate: function(itm,e,cls,ctx,p) {
                            cls = cls || 'modDocument';
                            var r = {
                                class_key: cls
                                ,context_key: ctx || 'web'
                    Severity: Minor
                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 1 hr to fix

                      Function deleteDocument has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          ,deleteDocument: function(itm,e) {
                              var node = this.cm.activeNode;
                              var id = node.id.split('_');id = id[1];
                              var pagetitle = Ext.util.Format.htmlEncode(node.ui.textNode.innerText);
                              MODx.msg.confirm({
                      Severity: Minor
                      Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 1 hr to fix

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

                            ,_getCreateMenus: function(m,pk,ui) {
                                var types = MODx.config.resource_classes;
                                var o = this.fireEvent('loadCreateMenus',types);
                                if (Ext.isObject(o)) {
                                    Ext.apply(types,o);
                        Severity: Minor
                        Found in manager/assets/modext/widgets/resource/modx.tree.resource.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 undeleteDocument has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            ,undeleteDocument: function(itm,e) {
                                var node = this.cm.activeNode;
                                var id = node.id.split('_');id = id[1];
                                MODx.Ajax.request({
                                    url: MODx.config.connector_url
                        Severity: Minor
                        Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 1 hr to fix

                          Function _handleDrag has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              ,_handleDrag: function(dropEvent) {
                                  function simplifyNodes(node) {
                                      var resultNode = {};
                                      var kids = node.childNodes;
                                      var len = kids.length;
                          Severity: Minor
                          Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 1 hr to fix

                            Function quickUpdate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                ,quickUpdate: function(itm,e,cls) {
                                    MODx.Ajax.request({
                                        url: MODx.config.connector_url
                                        ,params: {
                                            action: 'resource/get'
                            Severity: Minor
                            Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 1 hr to fix

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

                                  ,deleteDocument: function(itm,e) {
                                      var node = this.cm.activeNode;
                                      var id = node.id.split('_');id = id[1];
                                      var pagetitle = Ext.util.Format.htmlEncode(node.ui.textNode.innerText);
                                      MODx.msg.confirm({
                              Severity: Minor
                              Found in manager/assets/modext/widgets/resource/modx.tree.resource.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 _handleDrop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  ,_handleDrop:  function(e){
                                      var dropNode = e.dropNode;
                                      var targetParent = e.target;
                              
                                      if (targetParent.findChild('id',dropNode.attributes.id) !== null) {return false;}
                              Severity: Minor
                              Found in manager/assets/modext/widgets/resource/modx.tree.resource.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 undeleteDocument has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  ,undeleteDocument: function(itm,e) {
                                      var node = this.cm.activeNode;
                                      var id = node.id.split('_');id = id[1];
                                      MODx.Ajax.request({
                                          url: MODx.config.connector_url
                              Severity: Minor
                              Found in manager/assets/modext/widgets/resource/modx.tree.resource.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 quickCreate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  ,quickCreate: function(itm,e,cls,ctx,p) {
                              Severity: Minor
                              Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 35 mins to fix

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

                                    ,getDefaultSortBy: function(config) {
                                        var v = 'menuindex';
                                        if (!Ext.isEmpty(config) && !Ext.isEmpty(config.sortBy)) {
                                            v = config.sortBy;
                                        } else {
                                Severity: Minor
                                Found in manager/assets/modext/widgets/resource/modx.tree.resource.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

                                Avoid too many return statements within this function.
                                Open

                                            return false;
                                Severity: Major
                                Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                          return dropNode.attributes.text != 'root' && dropNode.attributes.text !== ''
                                              && targetParent.attributes.text != 'root' && targetParent.attributes.text !== '';
                                  Severity: Major
                                  Found in manager/assets/modext/widgets/resource/modx.tree.resource.js - About 30 mins to fix

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

                                                ,listeners: {
                                                    'success': {fn:function(data) {
                                                        var trashButton = this.getTopToolbar().findById('emptifier');
                                                        if (trashButton) {
                                                            if (data.object.deletedCount == 0) {
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 1 day to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 220..249

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

                                    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

                                                ,listeners: {
                                                    'success': {fn:function(data) {
                                                        var trashButton = this.getTopToolbar().findById('emptifier');
                                                        if (trashButton) {
                                                            if (data.object.deletedCount == 0) {
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 1 day to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 262..291

                                    Duplicated Code

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

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

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

                                    Tuning

                                    This issue has a mass of 267.

                                    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

                                        ,publishDocument: function(itm,e) {
                                            var node = this.cm.activeNode;
                                            var id = node.id.split('_');id = id[1];
                                            MODx.msg.confirm({
                                                title: _('resource_publish')
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 1 day to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 316..335

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

                                    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

                                        ,unpublishDocument: function(itm,e) {
                                            var node = this.cm.activeNode;
                                            var id = node.id.split('_');id = id[1];
                                            MODx.msg.confirm({
                                                title: _('resource_unpublish')
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 1 day to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 295..314

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

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

                                                ,listeners: {
                                                    'success': {fn:function(r) {
                                                        var el = dropEvent.dropNode.getUI().getTextEl();
                                                        if (el) {Ext.get(el).frame();}
                                                        this.fireEvent('afterSort',{event:dropEvent,result:r});
                                    manager/assets/modext/widgets/core/tree/modx.tree.js on lines 620..637
                                    manager/assets/modext/widgets/system/modx.tree.directory.js on lines 334..345

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

                                    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((MODx.request.a == MODx.action['resource/update']) && dropNode.attributes.pk == MODx.request.id){
                                                var parentFieldCmb = Ext.getCmp('modx-resource-parent');
                                                var parentFieldHidden = Ext.getCmp('modx-resource-parent-hidden');
                                                if(parentFieldCmb && parentFieldHidden){
                                                    parentFieldHidden.setValue(dropNode.parentNode.attributes.pk);
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 5 hrs to fix
                                    manager/assets/modext/widgets/system/modx.tree.directory.js on lines 311..318

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

                                    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

                                                },{
                                                    xtype: va['canpublish'] ? 'xdatetime' : 'hidden'
                                                    ,fieldLabel: _('resource_publishdate')
                                                    ,description: '<b>[[*pub_date]]</b><br />'+_('resource_publishdate_help')
                                                    ,name: 'pub_date'
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 5 hrs to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 1221..1235

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

                                    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

                                                },{
                                                    xtype: va['canpublish'] ? 'xdatetime' : 'hidden'
                                                    ,fieldLabel: _('resource_unpublishdate')
                                                    ,description: '<b>[[*unpub_date]]</b><br />'+_('resource_unpublishdate_help')
                                                    ,name: 'unpub_date'
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 5 hrs to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 1207..1221

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

                                    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

                                            function simplifyNodes(node) {
                                                var resultNode = {};
                                                var kids = node.childNodes;
                                                var len = kids.length;
                                                for (var i = 0; i < len; i++) {
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 2 hrs to fix
                                    manager/assets/modext/widgets/core/tree/modx.tree.js on lines 597..605

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

                                    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

                                                },{
                                                    xtype: 'xcheckbox'
                                                    ,boxLabel: _('resource_alias_visible')
                                                    ,description: _('resource_alias_visible_help')
                                                    ,hideLabel: true
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 2 hrs to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 1281..1290

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

                                    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

                                                },{
                                                    xtype: 'xcheckbox'
                                                    ,boxLabel: _('deleted')
                                                    ,description: _('resource_delete')
                                                    ,hideLabel: true
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 2 hrs to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 1290..1299

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

                                    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 (o.event.point == 'append' && targetNode) {
                                                var ui = targetNode.getUI();
                                                ui.addClass('haschildren');
                                                ui.removeClass('icon-resource');
                                            }
                                    manager/assets/modext/widgets/system/modx.tree.directory.js on lines 306..310

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

                                    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

                                                        w.title += ': <span dir="ltr">' + Ext.util.Format.htmlEncode(w.record.pagetitle) + ' ('+ w.record.id + ')</span>';
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 350..350

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

                                    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 (ui.hasClass('pdelete')) {
                                                m.push('-');
                                                m.push({
                                                    text: _('context_remove')
                                                    ,handler: this.removeContext
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 575..581

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

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

                                                            },{
                                                                xtype: 'textfield'
                                                                ,name: 'menutitle'
                                                                ,id: 'modx-'+this.ident+'-menutitle'
                                                                ,fieldLabel: _('resource_menutitle')
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 899..906
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 942..949

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

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

                                                            },{
                                                                xtype: 'textfield'
                                                                ,name: 'longtitle'
                                                                ,id: 'modx-'+this.ident+'-longtitle'
                                                                ,fieldLabel: _('resource_longtitle')
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 942..949
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 949..956

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

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

                                                            },{
                                                                xtype: 'textfield'
                                                                ,name: 'alias'
                                                                ,id: 'modx-'+this.ident+'-alias'
                                                                ,fieldLabel: _('resource_alias')
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 899..906
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 949..956

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

                                    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

                                            w.show(e.target,function() {
                                                Ext.isSafari ? w.setPosition(null,30) : w.center();
                                            },this);
                                    Severity: Minor
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 50 mins to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 498..500

                                    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

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

                                                        w.show(e.target,function() {
                                                            Ext.isSafari ? w.setPosition(null,30) : w.center();
                                                        },this);
                                    Severity: Minor
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 50 mins to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 466..468

                                    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

                                    Identical blocks of code found in 4 locations. Consider refactoring.
                                    Open

                                            m.push({
                                                text: '<b>'+a.text+'</b>'
                                                ,handler: function() {return false;}
                                                ,header: true
                                            });
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 3 other locations - About 35 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 470..474
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 547..551
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 511..515

                                    Duplicated Code

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

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

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

                                    Tuning

                                    This issue has a mass of 47.

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

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

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

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

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 4 locations. Consider refactoring.
                                    Open

                                            m.push({
                                                text: '<b>'+a.text+'</b>'
                                                ,handler: function() {return false;}
                                                ,header: true
                                            });
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 3 other locations - About 35 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 470..474
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 547..551
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 570..574

                                    Duplicated Code

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

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

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

                                    Tuning

                                    This issue has a mass of 47.

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

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

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

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

                                    Refactorings

                                    Further Reading

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

                                            if(!ui.hasClass('x-tree-node-leaf')) {
                                                m.push('-');
                                                m.push(this._getSortMenu());
                                            }
                                    Severity: Minor
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 35 mins to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 550..553

                                    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

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

                                            if(!ui.hasClass('x-tree-node-leaf')) {
                                                m.push('-');
                                                m.push(this._getSortMenu());
                                            }
                                    Severity: Minor
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 1 other location - About 35 mins to fix
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 638..641

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

                                            if (ui.hasClass('pview')) {
                                                m.push({
                                                    text: _('resource_overview')
                                                    ,handler: this.overviewResource
                                                });
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 7 other locations - About 30 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 533..538
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 553..558
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 559..564
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 536..541
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 582..587
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 595..600
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 619..624

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

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

                                            if (ui.hasClass('pedit')) {
                                                m.push({
                                                    text: _('resource_edit')
                                                    ,handler: this.editResource
                                                });
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 7 other locations - About 30 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 533..538
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 553..558
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 559..564
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 536..541
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 576..581
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 595..600
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 619..624

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

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

                                            if (ui.hasClass('pnew')) {
                                                m.push({
                                                    text: _('context_duplicate')
                                                    ,handler: this.duplicateContext
                                                });
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 7 other locations - About 30 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 533..538
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 553..558
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 559..564
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 576..581
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 582..587
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 595..600
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 619..624

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

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

                                            if (ui.hasClass('pduplicate')) {
                                                m.push({
                                                    text: _('resource_duplicate')
                                                    ,handler: this.duplicateResource
                                                });
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 7 other locations - About 30 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 533..538
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 553..558
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 559..564
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 536..541
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 576..581
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 582..587
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 619..624

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

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

                                                } else if (ui.hasClass('punpublish')) {
                                                    m.push({
                                                        text: _('resource_unpublish')
                                                        ,handler: this.unpublishDocument
                                                    });
                                    Severity: Major
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 7 other locations - About 30 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 533..538
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 553..558
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 559..564
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 536..541
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 576..581
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 582..587
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 595..600

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

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

                                            m.push({
                                                text: _('create')
                                                ,handler: function() {return false;}
                                                ,menu: {items: ct}
                                            });
                                    Severity: Minor
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 2 other locations - About 30 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 455..461
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 708..712

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

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

                                                m.push({
                                                    text: _('quick_create')
                                                    ,handler: function() {return false;}
                                                    ,menu: {items: qct}
                                                });
                                    Severity: Minor
                                    Found in manager/assets/modext/widgets/resource/modx.tree.resource.js and 2 other locations - About 30 mins to fix
                                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 455..461
                                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 702..706

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

                                    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