modxcms/revolution

View on GitHub
manager/assets/modext/widgets/media/browser.js

Summary

Maintainability
D
2 days
Test Coverage

Function Media has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MODx.Media = function(config) {
    config = config || {};

    this.ident = config.ident || Ext.id();

Severity: Major
Found in manager/assets/modext/widgets/media/browser.js - About 3 hrs to fix

    Function getToolbar has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ,getToolbar: function() {
            return [{
                text: _('filter')+':'
                ,xtype: 'label'
            },{
    Severity: Major
    Found in manager/assets/modext/widgets/media/browser.js - About 2 hrs to fix

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

          ,load: function(dir) {
              dir = dir || (Ext.isEmpty(this.config.openTo) ? '' : this.config.openTo);
              this.view.run({
                  dir: dir
                  ,source: this.config.source
      Severity: Major
      Found in manager/assets/modext/widgets/media/browser.js and 3 other locations - About 4 hrs to fix
      manager/assets/modext/widgets/media/modx.browser.js on lines 607..616
      manager/assets/modext/widgets/media/modx.browser.js on lines 962..971
      manager/assets/modext/widgets/media/modx.browser.js on lines 1337..1346

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

      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

          ,reset: function() {
              if (this.rendered) {
                  Ext.getCmp(this.ident+'filter').reset();
                  this.view.getEl().dom.scrollTop = 0;
              }
      Severity: Major
      Found in manager/assets/modext/widgets/media/browser.js and 3 other locations - About 3 hrs to fix
      manager/assets/modext/widgets/media/modx.browser.js on lines 639..646
      manager/assets/modext/widgets/media/modx.browser.js on lines 994..1001
      manager/assets/modext/widgets/media/modx.browser.js on lines 1369..1376

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

      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

          ,sortStore: function(){
              var v = Ext.getCmp(this.ident+'sortSelect').getValue();
              this.view.store.sort(v, v == 'name' ? 'asc' : 'desc');
              this.view.select(0);
          }
      Severity: Major
      Found in manager/assets/modext/widgets/media/browser.js and 3 other locations - About 2 hrs to fix
      manager/assets/modext/widgets/media/modx.browser.js on lines 621..625
      manager/assets/modext/widgets/media/modx.browser.js on lines 976..980
      manager/assets/modext/widgets/media/modx.browser.js on lines 1351..1355

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

      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

          ,changeViewmode: function() {
              var v = Ext.getCmp(this.ident+'viewSelect').getValue();
              this.view.setTemplate(v);
              this.view.select(0);
          }
      Severity: Major
      Found in manager/assets/modext/widgets/media/browser.js and 3 other locations - About 1 hr to fix
      manager/assets/modext/widgets/media/modx.browser.js on lines 630..634
      manager/assets/modext/widgets/media/modx.browser.js on lines 985..989
      manager/assets/modext/widgets/media/modx.browser.js on lines 1360..1364

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

      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

              ,items: [{
                  region: 'west'
                  ,width: 250
                  ,items: this.tree
                  ,id: this.ident+'-browser-tree'
      Severity: Minor
      Found in manager/assets/modext/widgets/media/browser.js and 1 other location - About 40 mins to fix
      manager/assets/modext/widgets/media/modx.browser.js on lines 915..923

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 49.

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

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

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

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

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status