modxcms/revolution

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

Summary

Maintainability
F
1 wk
Test Coverage

Function Snippet has 274 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MODx.panel.Snippet = function(config) {
    config = config || {};
    config.record = config.record || {};
    config = MODx.setStaticElementsConfig(config, 'snippet');

Severity: Major
Found in manager/assets/modext/widgets/element/modx.panel.snippet.js - About 1 day to fix

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

    /**
     * @class MODx.panel.Snippet
     * @extends MODx.FormPanel
     * @param {Object} config An object of configuration properties
     * @xtype panel-snippet
    Severity: Minor
    Found in manager/assets/modext/widgets/element/modx.panel.snippet.js - About 4 hrs to fix

      Function Snippet has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      MODx.panel.Snippet = function(config) {
          config = config || {};
          config.record = config.record || {};
          config = MODx.setStaticElementsConfig(config, 'snippet');
      
      
      Severity: Minor
      Found in manager/assets/modext/widgets/element/modx.panel.snippet.js - About 4 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          ,toggleStaticFile: function(cb) {
              var flds = ['modx-snippet-static-file','modx-snippet-static-file-help','modx-snippet-static-source','modx-snippet-static-source-help'];
              var fld,i;
              if (cb.checked) {
                  for (i in flds) {
      Severity: Minor
      Found in manager/assets/modext/widgets/element/modx.panel.snippet.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 setup has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ,setup: function() {
      
              if (!this.initialized) {
                  /*
                      The itemId (not id) of each form tab to be included/excluded; these correspond to the
      Severity: Minor
      Found in manager/assets/modext/widgets/element/modx.panel.snippet.js - About 1 hr to fix

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

            ,setup: function() {
        
                if (!this.initialized) {
                    /*
                        The itemId (not id) of each form tab to be included/excluded; these correspond to the
        Severity: Minor
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js - About 55 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            ,success: function(r) {
                if (MODx.request.id) Ext.getCmp('modx-grid-element-properties').save();
                this.getForm().setValues(r.result.object);
        
                var t = Ext.getCmp('modx-tree-element');
        Severity: Minor
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.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

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

                            },{
                                xtype: 'textfield'
                                ,fieldLabel: _('name')+'<span class="required">*</span>'
                                ,description: MODx.expandHelp ? '' : _('snippet_desc_name')
                                ,name: 'name'
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 3 other locations - About 1 day to fix
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 66..90
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 66..90
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 71..95

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

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

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

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

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

        Refactorings

        Further Reading

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

                            },{
                                xtype: 'modx-combo-browser'
                                ,browserEl: 'modx-browser'
                                ,fieldLabel: _('static_file')
                                ,description: MODx.expandHelp ? '' : _('static_file_msg')
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 2 other locations - About 1 day to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 107..134
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 109..136

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

        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

                            },{
                                xtype: 'modx-combo-source'
                                ,fieldLabel: _('static_source')
                                ,description: MODx.expandHelp ? '' : _('static_source_msg')
                                ,name: 'source'
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 4 other locations - About 6 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 212..234
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 229..251
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 227..249
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 230..252

        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

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

            ,changeEditor: function() {
                this.cleanupEditor();
                this.on('success',function(o) {
                    var id = o.result.object.id;
                    var w = Ext.getCmp('modx-snippet-which-editor').getValue();
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 2 other locations - About 5 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 397..406
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 399..408

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

                            ,items: [{
                                xtype: 'modx-combo-category'
                                ,fieldLabel: _('category')
                                ,description: MODx.expandHelp ? '' : _('snippet_desc_category')
                                ,name: 'category'
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 3 other locations - About 5 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 148..164
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 151..167
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 164..180

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

        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

            ,toggleStaticFile: function(cb) {
                var flds = ['modx-snippet-static-file','modx-snippet-static-file-help','modx-snippet-static-source','modx-snippet-static-source-help'];
                var fld,i;
                if (cb.checked) {
                    for (i in flds) {
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 4 other locations - About 5 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 368..382
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 413..427
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 415..429
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 485..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 136.

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

                if (!Ext.isEmpty(this.config.record.name)) {
                    var title = _('snippet')+': '+this.config.record.name;
                    if (MODx.perm.tree_show_element_ids === 1) {
                        title = title+ ' <small>('+this.config.record.id+')</small>';
                    }
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 3 other locations - About 5 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 305..311
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 339..345
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 397..403

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

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

                ,listeners: {
                    'setup': {fn:this.setup,scope:this}
                    ,'success': {fn:this.success,scope:this}
                    ,'failure': {fn:this.failure,scope:this}
                    ,'beforeSubmit': {fn:this.beforeSubmit,scope:this}
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 3 other locations - About 4 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 270..281
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 305..316
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 307..318

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 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

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

            ,beforeSubmit: function(o) {
                this.cleanupEditor();
                Ext.apply(o.form.baseParams,{
                    propdata: Ext.getCmp('modx-grid-element-properties').encode()
                });
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 1 other location - About 3 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 338..347

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

        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

                if (!Ext.isEmpty(this.config.record.properties)) {
                    var d = this.config.record.properties;
                    var g = Ext.getCmp('modx-grid-element-properties');
                    if (g) {
                        g.defaultProperties = d;
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 3 other locations - About 3 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 312..319
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 346..353
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 348..355

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

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

                    },{
                        xtype: 'panel'
                        ,border: false
                        ,layout: 'form'
                        ,cls:'main-wrapper'
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 3 other locations - About 2 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 244..259
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 262..277
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 259..274

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

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

                            },{
                                xtype: 'xcheckbox'
                                ,boxLabel: _('clear_cache_on_save')
                                ,description: MODx.expandHelp ? '' : _('clear_cache_on_save_msg')
                                ,hideLabel: true
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 3 other locations - About 2 hrs to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 182..192
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 200..209
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 198..207

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

        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

                            },{
                                xtype: 'xcheckbox'
                                ,hideLabel: true
                                ,boxLabel: _('is_static')
                                ,description: MODx.expandHelp ? '' : _('is_static_msg')
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 197..206
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 214..223
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 212..221
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 215..224

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

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

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

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

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

        Refactorings

        Further Reading

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

                            },{
                                xtype: 'textarea'
                                ,fieldLabel: _('snippet_desc')
                                ,description: MODx.expandHelp ? '' : _('snippet_desc_description')
                                ,name: 'description'
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 95..104
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 113..122

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

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

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

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

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

        Refactorings

        Further Reading

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

                if (!this.initialized) {
                    /*
                        The itemId (not id) of each form tab to be included/excluded; these correspond to the
                        keys in each tab component's items property
                    */
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 1 other location - About 1 hr to fix
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 292..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 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 5 locations. Consider refactoring.
        Open

            ,changeSource: function() {
                var browser = Ext.getCmp('modx-snippet-static-file')
                    ,source = Ext.getCmp('modx-snippet-static-source').getValue();
        
                browser.config.source = source;
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 331..336
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 364..369
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 367..372
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 432..437

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

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

                            },{
                                xtype: MODx.expandHelp ? 'label' : 'hidden'
                                ,forId: 'modx-snippet-static-source'
                                ,id: 'modx-snippet-static-source-help'
                                ,html: _('static_source_msg')
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 134..142
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 234..242
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 136..144
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 251..259
        manager/assets/modext/widgets/element/modx.panel.snippet.js on lines 135..143
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 134..142
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 249..257
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 142..150
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 252..260

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

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

                            },{
                                xtype: MODx.expandHelp ? 'label' : 'hidden'
                                ,forId: 'modx-snippet-static-file'
                                ,id: 'modx-snippet-static-file-help'
                                ,html: _('static_file_msg')
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 134..142
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 234..242
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 136..144
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 251..259
        manager/assets/modext/widgets/element/modx.panel.snippet.js on lines 235..243
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 134..142
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 249..257
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 142..150
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 252..260

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

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

                        ,defaults: {
                            layout: 'form'
                            ,labelAlign: 'top'
                            ,anchor: '100%'
                            ,border: false
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 39..51
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 41..53
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 41..53
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 46..58

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

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

            ,cleanupEditor: function() {
                if (MODx.onSaveEditor) {
                    var fld = Ext.getCmp('modx-snippet-snippet');
                    MODx.onSaveEditor(fld);
                }
        Severity: Major
        Found in manager/assets/modext/widgets/element/modx.panel.snippet.js and 6 other locations - About 35 mins to fix
        manager/assets/modext/sections/system/file/create.js on lines 139..144
        manager/assets/modext/sections/system/file/edit.js on lines 157..162
        manager/assets/modext/widgets/element/modx.panel.chunk.js on lines 362..367
        manager/assets/modext/widgets/element/modx.panel.plugin.js on lines 407..412
        manager/assets/modext/widgets/element/modx.panel.template.js on lines 409..414
        manager/assets/modext/widgets/element/modx.panel.tv.js on lines 478..483

        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

        There are no issues that match your filters.

        Category
        Status