modxcms/revolution

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

Summary

Maintainability
F
6 days
Test Coverage

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

/**
 * Generates the Element Tree
 *
 * @class MODx.tree.Element
 * @extends MODx.tree.Tree
Severity: Major
Found in manager/assets/modext/widgets/element/modx.tree.element.js - About 1 day to fix

    Function _getElementMenu has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function Element has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      MODx.tree.Element = function(config) {
          config = config || {};
          Ext.applyIf(config,{
              rootVisible: false
              ,enableDD: !Ext.isEmpty(MODx.config.enable_dragdrop) ? true : false
      Severity: Major
      Found in manager/assets/modext/widgets/element/modx.tree.element.js - About 2 hrs to fix

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

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

          Function _getElementMenu has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

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

              ,extractElementIdentifiersFromActiveNode: function(activeNode) {
                  let startIndex;
                  const extractedData = {};
          
                  switch (true) {
          Severity: Minor
          Found in manager/assets/modext/widgets/element/modx.tree.element.js - About 1 hr to fix

            Function duplicateElement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

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

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

                    ,removeElement: function(itm, e) {
                        const elementIdentifiers = this.extractElementIdentifiersFromActiveNode(this.cm.activeNode);
                        MODx.msg.confirm({
                            title: _('warning'),
                            text: _('remove_this_confirm', {
                Severity: Minor
                Found in manager/assets/modext/widgets/element/modx.tree.element.js - About 1 hr to fix

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

                  MODx.tree.Element = function(config) {
                      config = config || {};
                      Ext.applyIf(config,{
                          rootVisible: false
                          ,enableDD: !Ext.isEmpty(MODx.config.enable_dragdrop) ? true : false
                  Severity: Minor
                  Found in manager/assets/modext/widgets/element/modx.tree.element.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

                  Avoid too many return statements within this function.
                  Open

                          return target.getDepth() > 0;
                  Severity: Major
                  Found in manager/assets/modext/widgets/element/modx.tree.element.js - About 30 mins to fix

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

                        ,_handleDrop: function(e) {
                            var target = e.target;
                            if (e.point == 'above' || e.point == 'below') {return false;}
                            if (target.attributes.classKey != 'modCategory' && target.attributes.classKey != 'root') { return false; }
                    
                    
                    Severity: Minor
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js - About 25 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                        ,activatePlugin: function(itm, e) {
                            const elementIdentifiers = this.extractElementIdentifiersFromActiveNode(this.cm.activeNode);
                            MODx.Ajax.request({
                                url: MODx.config.connector_url,
                                params: {
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 1 other location - About 4 hrs to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 284..301

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

                    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

                        ,deactivatePlugin: function(itm, e) {
                            const elementIdentifiers = this.extractElementIdentifiersFromActiveNode(this.cm.activeNode);
                            MODx.Ajax.request({
                                url: MODx.config.connector_url,
                                params: {
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 1 other location - About 4 hrs to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 265..282

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

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

                            },{
                                cls: 'tree-new-chunk'
                                ,tooltip: {text: _('new')+' '+_('chunk')}
                                ,handler: function() {
                                    this.redirect('?a=element/chunk/create');
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 4 other locations - About 2 hrs to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 24..32
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 32..40
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 48..56
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 56..64

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

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

                            },{
                                cls: 'tree-new-plugin'
                                ,tooltip: {text: _('new')+' '+_('plugin')}
                                ,handler: function() {
                                    this.redirect('?a=element/plugin/create');
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 4 other locations - About 2 hrs to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 24..32
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 32..40
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 40..48
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 48..56

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

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

                            ,tbar: [{
                                cls: 'tree-new-template'
                                ,tooltip: {text: _('new')+' '+_('template')}
                                ,handler: function() {
                                    this.redirect('?a=element/template/create');
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 4 other locations - About 2 hrs to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 32..40
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 40..48
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 48..56
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 56..64

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

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

                            },{
                                cls: 'tree-new-snippet'
                                ,tooltip: {text: _('new')+' '+_('snippet')}
                                ,handler: function() {
                                    this.redirect('?a=element/snippet/create');
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 4 other locations - About 2 hrs to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 24..32
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 32..40
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 40..48
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 56..64

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

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

                            },{
                                cls: 'tree-new-tv'
                                ,tooltip: {text: _('new')+' '+_('tv')}
                                ,handler: function() {
                                    this.redirect('?a=element/tv/create');
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 4 other locations - About 2 hrs to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 24..32
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 40..48
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 48..56
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 56..64

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

                    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

                                m.push({
                                    text: _('quick_create_'+a.type)
                                    ,type: a.type
                                    ,handler: function(itm,e) {
                                        this.quickCreate(itm,e,itm.type);
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 1 other location - About 1 hr to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 487..493

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                m.push({
                                    text: _('quick_update_'+a.type)
                                    ,type: a.type
                                    ,handler: function(itm,e) {
                                        this.quickUpdate(itm,e,itm.type);
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 1 other location - About 1 hr to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 595..601

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 67.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                        w.title += ': <span dir="ltr">' + Ext.util.Format.htmlEncode(w.record[nameField]) + ' ('+ w.record.id + ')</span>';
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 1 other location - About 1 hr to fix
                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 496..496

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 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('pdelcat')) {
                                m.push('-');
                                m.push({
                                    text: _('category_remove')
                                    ,handler: this.removeCategory
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 1 other location - About 1 hr to fix
                    manager/assets/modext/widgets/resource/modx.tree.resource.js on lines 542..548

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

                            if (ui.hasClass('pnew')) {
                                m.push({
                                    text: _('add_to_category_'+a.type)
                                    ,handler: this._createElement
                                });
                    Severity: Minor
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 1 other location - About 55 mins to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 520..525

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

                    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({
                                    text: _('remove_'+a.type)
                                    ,handler: this.removeElement
                                });
                    Severity: Minor
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 1 other location - About 55 mins to fix
                    manager/assets/modext/widgets/element/modx.tree.element.js on lines 527..532

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

                    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/element/modx.tree.element.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/resource/modx.tree.resource.js on lines 511..515
                    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 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/element/modx.tree.element.js and 3 other locations - About 35 mins to fix
                    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
                    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

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

                            if (ui.hasClass('pnewcat')) {
                                m.push({
                                    text: _('new_category')
                                    ,handler: this.createCategory
                                });
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.js and 7 other locations - About 30 mins to fix
                    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
                    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('pnewcat')) {
                                m.push({
                                    text: _('category_create')
                                    ,handler: this.createCategory
                                });
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.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 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
                    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('peditcat')) {
                                m.push({
                                    text: _('category_rename')
                                    ,handler: this.renameCategory
                                });
                    Severity: Major
                    Found in manager/assets/modext/widgets/element/modx.tree.element.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/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
                    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 3 locations. Consider refactoring.
                    Open

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

                    There are no issues that match your filters.

                    Category
                    Status