modxcms/revolution

View on GitHub
manager/assets/modext/workspace/package.panels.js

Summary

Maintainability
D
3 days
Test Coverage

File package.panels.js has 362 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * The panel who shows before package installation
 *
 * @class MODx.panel.PackageMetaPanel
 * @extends MODx.Tabs
Severity: Minor
Found in manager/assets/modext/workspace/package.panels.js - About 4 hrs to fix

    Function PackageDetails has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    MODx.panel.PackageDetails = function(config) {
        config = config || {};
    
        Ext.applyIf(config,{
            layout: 'column'
    Severity: Major
    Found in manager/assets/modext/workspace/package.panels.js - About 2 hrs to fix

      Function mainColumnRenderer has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          mainColumnRenderer: function (value, metaData, record, rowIndex, colIndex, store) {
              var rec = record.data;
              var state = (rec.installed !== null) ? ' installed' : ' not-installed';
              var values = {name: value, state: state, actions: null, message: null};
      
      
      Severity: Minor
      Found in manager/assets/modext/workspace/package.panels.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 updatePanel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ,updatePanel: function(meta, record){
              var installBtn = Ext.getCmp('package-install-btn');
              var setupoptionsBtn = Ext.getCmp('package-show-setupoptions-btn');
              this.updateBreadcrumbs(_('license_agreement_desc'), record);
              Ext.getCmp('package-list-reset').show();
      Severity: Minor
      Found in manager/assets/modext/workspace/package.panels.js - About 1 hr to fix

        Function mainColumnRenderer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            mainColumnRenderer: function (value, metaData, record, rowIndex, colIndex, store) {
                var rec = record.data;
                var state = (rec.installed !== null) ? ' installed' : ' not-installed';
                var values = {name: value, state: state, actions: null, message: null};
        
        
        Severity: Minor
        Found in manager/assets/modext/workspace/package.panels.js - About 1 hr to fix

          Function installColumnRenderer has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              ,installColumnRenderer: function (value, metaData, record, rowIndex, colIndex, store) {
          Severity: Minor
          Found in manager/assets/modext/workspace/package.panels.js - About 45 mins to fix

            Function mainColumnRenderer has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                mainColumnRenderer: function (value, metaData, record, rowIndex, colIndex, store) {
            Severity: Minor
            Found in manager/assets/modext/workspace/package.panels.js - About 45 mins to fix

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

                  ,updatePanel: function(meta, record){
                      var installBtn = Ext.getCmp('package-install-btn');
                      var setupoptionsBtn = Ext.getCmp('package-show-setupoptions-btn');
                      this.updateBreadcrumbs(_('license_agreement_desc'), record);
                      Ext.getCmp('package-list-reset').show();
              Severity: Minor
              Found in manager/assets/modext/workspace/package.panels.js - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  ,installColumnRenderer: function (value, metaData, record, rowIndex, colIndex, store) {
                      switch (value) {
                          case '':
                          case false:
                              metaData.css = 'not-installed';
              Severity: Minor
              Found in manager/assets/modext/workspace/package.panels.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 2 locations. Consider refactoring.
              Open

                      ,items:[{
                          xtype: 'modx-template-panel'
                          ,id: 'modx-package-details-metas'
                          ,columnWidth: 1
                          ,markup: '<div class="details">'
              Severity: Major
              Found in manager/assets/modext/workspace/package.panels.js and 1 other location - About 5 hrs to fix
              manager/assets/modext/workspace/package.browser.panels.js on lines 380..406

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

              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

                          case false:
                              metaData.css = 'not-installed';
                              if (record.data.name === 'php' || record.data.name === 'modx') {
                                  return _('not_available');
                              } else {
              Severity: Major
              Found in manager/assets/modext/workspace/package.panels.js and 1 other location - About 1 hr to fix
              manager/assets/modext/workspace/package.panels.js on lines 379..385

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 65.

              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

                          default:
                              metaData.css = '';
                              if (record.data.name === 'php' || record.data.name === 'modx') {
                                  return _('available');
                              } else {
              Severity: Major
              Found in manager/assets/modext/workspace/package.panels.js and 1 other location - About 1 hr to fix
              manager/assets/modext/workspace/package.panels.js on lines 372..378

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

              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

                  cols.push({ header: _('name') ,dataIndex: 'name' ,id:'main-installed' ,renderer: { fn: this.mainColumnRenderer, scope: this } });
              Severity: Minor
              Found in manager/assets/modext/workspace/package.panels.js and 1 other location - About 50 mins to fix
              manager/assets/modext/workspace/package.grid.js on lines 38..38

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 51.

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

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

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

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

              Refactorings

              Further Reading

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

                  cols.push({ header: _('installed') ,dataIndex: 'installed', id: 'info-col', fixed:true, width: 160 ,renderer: this.installColumnRenderer });
              Severity: Minor
              Found in manager/assets/modext/workspace/package.panels.js and 1 other location - About 45 mins to fix
              manager/assets/modext/workspace/package.grid.js on lines 40..40

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 50.

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

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

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

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

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status