modxcms/revolution

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

Summary

Maintainability
F
1 wk
Test Coverage

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

/**
 * Generates the Directory Tree
 *
 * @class MODx.tree.Directory
 * @extends MODx.tree.Tree
Severity: Major
Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 2 days to fix

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

    Ext.extend(MODx.tree.Directory,MODx.tree.Tree,{
    
        windows: {}
    
        /**
    Severity: Minor
    Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 4 hrs to fix

      Function Directory has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      MODx.tree.Directory = function(config) {
          config = config || {};
          config.id = config.id || Ext.id();
          Ext.applyIf(config,{
              rootVisible: true
      Severity: Major
      Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 3 hrs to fix

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

        MODx.window.QuickUpdateFile = function(config) {
            config = config || {};
            Ext.applyIf(config,{
                title: _('file_quick_update')
                ,width: 600
        Severity: Major
        Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 2 hrs to fix

          Function QuickCreateFile has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          MODx.window.QuickCreateFile = function(config) {
              config = config || {};
              Ext.applyIf(config,{
                  title: _('file_quick_create')
                  ,width: 600
          Severity: Minor
          Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

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

                ,uploadSuccess:function() {
                    if (this.cm.activeNode) {
                        var node = this.cm.activeNode;
                        if (node.isLeaf) {
                            var pn = (node.isLeaf() ? node.parentNode : node);
            Severity: Minor
            Found in manager/assets/modext/widgets/system/modx.tree.directory.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 RenameFile has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            MODx.window.RenameFile = function(config) {
                config = config || {};
                Ext.applyIf(config,{
                    title: _('rename')
                    // ,width: 430
            Severity: Minor
            Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

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

                  ,getRootMenu: function(node) {
                      var menu = [];
                      if (MODx.perm.directory_create) {
                          menu.push({
                              text: _('file_folder_create')
              Severity: Minor
              Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

                Function RenameDirectory has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                MODx.window.RenameDirectory = function(config) {
                    config = config || {};
                    Ext.applyIf(config,{
                        title: _('rename')
                        // ,width: 430
                Severity: Minor
                Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

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

                      ,showRefresh: function() {
                          var node = this.getRootNode()
                              ,inlineButtonsLang = this.getInlineButtonsLang(node)
                              ,elId = node.ui.elNode.id+ '_tools'
                              ,el = document.createElement('div');
                  Severity: Minor
                  Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

                    Function addSourceToolbar has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        ,addSourceToolbar: function() {
                            this.sourceCombo = new MODx.combo.MediaSource({
                                value: this.config.source || MODx.config.default_media_source
                                ,listWidth: 236
                                ,listeners: {
                    Severity: Minor
                    Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

                      Function quickUpdateFile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          ,quickUpdateFile: function(itm,e) {
                              var node = this.cm.activeNode;
                              MODx.Ajax.request({
                                  url: MODx.config.connector_url
                                  ,params: {
                      Severity: Minor
                      Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

                        Function ChmodDirectory has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        MODx.window.ChmodDirectory = function(config) {
                            config = config || {};
                            Ext.applyIf(config,{
                                title: _('file_folder_chmod')
                                // ,width: 430
                        Severity: Minor
                        Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

                          Function CreateDirectory has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          MODx.window.CreateDirectory = function(config) {
                              config = config || {};
                              Ext.applyIf(config,{
                                  title: _('file_folder_create')
                                  // width: 430
                          Severity: Minor
                          Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 1 hr to fix

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

                                ,createDirectory: function(item,e) {
                                    var node = this.cm && this.cm.activeNode ? this.cm.activeNode : false;
                                    var r = {
                                        parent: node && node.attributes.type == 'dir' ? node.attributes.pathRelative : '/'
                                        ,source: this.getSource()
                            Severity: Minor
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.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 addSourceToolbar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                ,addSourceToolbar: function() {
                                    this.sourceCombo = new MODx.combo.MediaSource({
                                        value: this.config.source || MODx.config.default_media_source
                                        ,listWidth: 236
                                        ,listeners: {
                            Severity: Minor
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 35 mins to fix

                            Cognitive Complexity

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

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

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

                            Further reading

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

                            MODx.tree.Directory = function(config) {
                                config = config || {};
                                config.id = config.id || Ext.id();
                                Ext.applyIf(config,{
                                    rootVisible: true
                            Severity: Minor
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 35 mins to fix

                            Cognitive Complexity

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

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

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

                            Further reading

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

                                ,getPath:function(node) {
                                    var path, p, a;
                            
                                    // get path for non-root node
                                    if(node !== this.root) {
                            Severity: Minor
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js - About 25 mins to fix

                            Cognitive Complexity

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

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

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

                            Further reading

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

                                    MODx.load({
                                        xtype: 'modx-button'
                                        ,text: ''
                                        ,scope: this
                                        ,tooltip: new Ext.ToolTip({
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 6 hrs to fix
                            manager/assets/modext/widgets/core/tree/modx.tree.js on lines 836..859

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

                            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});
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 2 other locations - About 6 hrs to fix
                            manager/assets/modext/widgets/core/tree/modx.tree.js on lines 620..637
                            manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 744..755

                            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/system/modx.tree.directory.js and 1 other location - About 5 hrs to fix
                            manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 378..385

                            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

                                ,removeDirectory: function(item,e) {
                                    var node = this.cm.activeNode;
                                    MODx.msg.confirm({
                                        text: _('file_folder_remove_confirm')
                                        ,url: MODx.config.connector_url
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 5 hrs to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 600..618

                            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

                                ,removeFile: function(item,e) {
                                    var node = this.cm.activeNode;
                                    MODx.msg.confirm({
                                        text: _('file_confirm_remove')
                                        ,url: MODx.config.connector_url
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 5 hrs to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 580..598

                            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

                                    var w = MODx.load({
                                        xtype: 'modx-window-directory-rename'
                                        ,record: r
                                        ,listeners: {
                                            'success':{fn:this.refreshParentNode,scope:this}
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 2 hrs to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 569..576

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

                            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

                                    var w = MODx.load({
                                        xtype: 'modx-window-directory-chmod'
                                        ,record: r
                                        ,listeners: {
                                            'success':{fn:this.refreshActiveNode,scope:this}
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 2 hrs to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 500..507

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

                            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');
                                    }
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 1 hr to fix
                            manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 373..377

                            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

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

                                                var w = MODx.load({
                                                    xtype: 'modx-window-file-quick-update'
                                                    ,record: r
                                                    ,listeners: {
                                                        'hide':{fn:function() {this.destroy();}}
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 1 hr to fix
                            manager/assets/modext/widgets/media/modx.browser.js on lines 150..156

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

                            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

                                    },{
                                        cls: 'x-btn-icon icon-file_upload'
                                        ,tooltip: {text: _('upload_files')}
                                        ,handler: this.uploadFiles
                                        ,scope: this
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 33..39
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 39..45

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

                            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

                                    ,tbar: [{
                                        cls: 'x-btn-icon icon-folder'
                                        ,tooltip: {text: _('file_folder_create')}
                                        ,handler: this.createDirectory
                                        ,scope: this
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 39..45
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 45..51

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

                            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

                                    },{
                                        cls: 'x-btn-icon icon-page_white'
                                        ,tooltip: {text: _('file_create')}
                                        ,handler: this.createFile
                                        ,scope: this
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 33..39
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 45..51

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

                            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 (node.isRoot) {
                                        m = this.getRootMenu(node);
                                    } else if (node.attributes.menu && node.attributes.menu.items) {
                                        m = node.attributes.menu.items;
                                    }
                            Severity: Minor
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 50 mins to fix
                            manager/assets/modext/widgets/core/tree/modx.tree.js on lines 347..351

                            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

                                    var r = {
                                        old_name: node.text
                                        ,name: node.text
                                        ,path: node.attributes.pathRelative
                                        ,source: this.getSource()
                            Severity: Minor
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 50 mins to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 513..518

                            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

                                    var r = {
                                        old_name: node.text
                                        ,name: node.text
                                        ,path: node.attributes.pathRelative
                                        ,source: this.getSource()
                            Severity: Minor
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 50 mins to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 494..499

                            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

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

                                    if (MODx.perm.file_upload) {
                                        menu.push({
                                            text: _('upload_files')
                                            ,handler: this.uploadFiles
                                            ,scope: this
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 2 other locations - About 45 mins to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 110..116
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 118..124

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

                            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

                                    if (MODx.perm.directory_create) {
                                        menu.push({
                                            text: _('file_folder_create')
                                            ,handler: this.createDirectory
                                            ,scope: this
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 2 other locations - About 45 mins to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 118..124
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 126..132

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

                            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

                                    if (MODx.perm.file_create) {
                                        menu.push({
                                            text: _('file_create')
                                            ,handler: this.createFile
                                            ,scope: this
                            Severity: Major
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 2 other locations - About 45 mins to fix
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 110..116
                            manager/assets/modext/widgets/system/modx.tree.directory.js on lines 126..132

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

                            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 (m && m.length > 0) {
                                        this.addContextMenuItem(m);
                                        this.cm.showAt(e.xy);
                                    }
                            Severity: Minor
                            Found in manager/assets/modext/widgets/system/modx.tree.directory.js and 1 other location - About 40 mins to fix
                            manager/assets/modext/widgets/core/tree/modx.tree.js on lines 353..356

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 49.

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

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

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

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

                            Refactorings

                            Further Reading

                            There are no issues that match your filters.

                            Category
                            Status