modxcms/revolution

View on GitHub
manager/assets/modext/widgets/core/modx.orm.js

Summary

Maintainability
F
1 wk
Test Coverage

File modx.orm.js has 432 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Ext.ns('MODx.orm');
MODx.orm.Tree = function(config) {
    config = config || {};
    Ext.applyIf(config,{
        height: 300
Severity: Minor
Found in manager/assets/modext/widgets/core/modx.orm.js - About 6 hrs to fix

    Function _showContextMenu has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ,_showContextMenu: function(node,e) {
            node.select();
            this.cm.activeNode = node;
            this.cm.removeAll();
            var m = [];
    Severity: Minor
    Found in manager/assets/modext/widgets/core/modx.orm.js - About 1 hr to fix

      Function Tree has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      MODx.orm.Tree = function(config) {
          config = config || {};
          Ext.applyIf(config,{
              height: 300
              ,width: 400
      Severity: Minor
      Found in manager/assets/modext/widgets/core/modx.orm.js - About 1 hr to fix

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

        MODx.orm.Form = function(config) {
            Ext.applyIf(config,{
                layout: 'form'
                ,xtype: 'fieldset'
                ,labelWidth: 150
        Severity: Minor
        Found in manager/assets/modext/widgets/core/modx.orm.js - About 1 hr to fix

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

              ,addContainer: function(btn,e,node) {
                  var r = {};
                  if (node) { r.parent = node.id; }
          
                  if (!this.windows.addContainer) {
          Severity: Minor
          Found in manager/assets/modext/widgets/core/modx.orm.js - About 1 hr to fix

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

                ,addAttribute: function(btn,e,node) {
                    var r = {};
                    if (node) { r.parent = node.id; }
            
                    if (!this.windows.addAttribute) {
            Severity: Minor
            Found in manager/assets/modext/widgets/core/modx.orm.js - About 1 hr to fix

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

                  ,addContainer: function(btn,e,node) {
                      var r = {};
                      if (node) { r.parent = node.id; }
              
                      if (!this.windows.addContainer) {
              Severity: Minor
              Found in manager/assets/modext/widgets/core/modx.orm.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 addAttribute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  ,addAttribute: function(btn,e,node) {
                      var r = {};
                      if (node) { r.parent = node.id; }
              
                      if (!this.windows.addAttribute) {
              Severity: Minor
              Found in manager/assets/modext/widgets/core/modx.orm.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 encode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  ,encode: function(node) {
                      if (!node) { node = this.getRootNode(); }
                      var _encode = function(node) {
                          var resultNode = {};
                          var kids = node.childNodes;
              Severity: Minor
              Found in manager/assets/modext/widgets/core/modx.orm.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

              Ext.extend(MODx.window.AddOrmContainer,MODx.Window,{
                  submit: function() {
                      var v = this.fp.getForm().getValues();
              
                      if (this.config.tree.childExistsOnSelected(v.name)) {
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 1 other location - About 1 day to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 358..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 201.

              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

              Ext.extend(MODx.window.AddOrmAttribute,MODx.Window,{
                  submit: function() {
                      var v = this.fp.getForm().getValues();
              
                      if (this.config.tree.childExistsOnSelected(v.name)) {
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 1 other location - About 1 day to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 405..425

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

              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

              MODx.window.AddOrmContainer = function(config) {
                  config = config || {};
                  this.ident = config.ident || 'ormccont'+Ext.id();
                  Ext.applyIf(config,{
                      title: _('orm_container_add')
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 1 other location - About 1 day to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 428..450

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

              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

              MODx.window.RenameOrmContainer = function(config) {
                  config = config || {};
                  this.ident = config.ident || 'ormrcont'+Ext.id();
                  Ext.applyIf(config,{
                      title: _('orm_container_rename')
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 1 other location - About 1 day to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 382..404

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

              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

                  ,removeContainer: function(btn,e) {
                      var n = this.getSelectedNode();
                      if (n) {
                          Ext.Msg.confirm(_('orm_container_remove'),_('orm_container_remove_confirm'),function(e) {
                              if (e == 'yes') {
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 1 other location - About 3 hrs to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 108..118

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

              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

                  ,removeAttribute: function(btn,e) {
                      var n = this.getSelectedNode();
                      if (n) {
                          Ext.Msg.confirm(_('orm_attribute_remove'),_('orm_attribute_remove_confirm'),function(e) {
                              if (e == 'yes') {
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 1 other location - About 3 hrs to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 119..129

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

              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

                  ,addContextMenuItem: function(items) {
                      var a = items, l = a.length;
                      for(var i = 0; i < l; i++) {
                          a[i].scope = this;
                          this.cm.add(a[i]);
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 1 other location - About 2 hrs to fix
              manager/assets/modext/widgets/core/modx.tree.checkbox.js on lines 113..119

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

              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: _('orm_attribute_add_below')
                              ,handler: function(itm,e) {
                                  this.addAttribute(itm,e,this.cm.activeNode);
                              }
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 2 other locations - About 1 hr to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 71..77
              manager/assets/modext/widgets/core/modx.orm.js on lines 79..85

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

                          m.push({
                              text: _('orm_container_rename')
                              ,handler: function(itm,e) {
                                  this.renameContainer(itm,e,this.cm.activeNode);
                              }
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 2 other locations - About 1 hr to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 64..70
              manager/assets/modext/widgets/core/modx.orm.js on lines 71..77

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

                          m.push({
                              text: _('orm_container_add_below')
                              ,handler: function(itm,e) {
                                  this.addContainer(itm,e,this.cm.activeNode);
                              }
              Severity: Major
              Found in manager/assets/modext/widgets/core/modx.orm.js and 2 other locations - About 1 hr to fix
              manager/assets/modext/widgets/core/modx.orm.js on lines 64..70
              manager/assets/modext/widgets/core/modx.orm.js on lines 79..85

              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

              There are no issues that match your filters.

              Category
              Status