modxcms/revolution

View on GitHub
manager/assets/modext/widgets/security/modx.tree.user.group.js

Summary

Maintainability
F
4 days
Test Coverage

Function CreateUserGroup has 152 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MODx.window.CreateUserGroup = function(config) {
    config = config || {};
    this.ident = config.ident || 'cugrp'+Ext.id();
    Ext.applyIf(config,{
        title: _('create_user_group')
Severity: Major
Found in manager/assets/modext/widgets/security/modx.tree.user.group.js - About 6 hrs to fix

    File modx.tree.user.group.js has 369 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Generates the User Group Tree
     *
     * @class MODx.tree.UserGroup
     * @extends MODx.tree.Tree
    Severity: Minor
    Found in manager/assets/modext/widgets/security/modx.tree.user.group.js - About 4 hrs to fix

      Function AddUserToUserGroup has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      MODx.window.AddUserToUserGroup = function(config) {
          config = config || {};
          this.ident = config.ident || 'adtug'+Ext.id();
          Ext.applyIf(config,{
              title: _('user_group_user_add')
      Severity: Minor
      Found in manager/assets/modext/widgets/security/modx.tree.user.group.js - About 1 hr to fix

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

        MODx.window.CreateUserGroup = function(config) {
            config = config || {};
            this.ident = config.ident || 'cugrp'+Ext.id();
            Ext.applyIf(config,{
                title: _('create_user_group')
        Severity: Minor
        Found in manager/assets/modext/widgets/security/modx.tree.user.group.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 getMenu has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ,getMenu: function() {
                var m = [];
                var n = this.cm.activeNode;
                var ui = n.getUI();
        
        
        Severity: Minor
        Found in manager/assets/modext/widgets/security/modx.tree.user.group.js - About 1 hr to fix

          Function getMenu has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              ,getMenu: function() {
                  var m = [];
                  var n = this.cm.activeNode;
                  var ui = n.getUI();
          
          
          Severity: Minor
          Found in manager/assets/modext/widgets/security/modx.tree.user.group.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 createUserGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              ,createUserGroup: function(item,e,tbar) {
                  tbar = tbar || false;
                  var p;
                  if (tbar === false) {
                      var n = this.cm.activeNode;
          Severity: Minor
          Found in manager/assets/modext/widgets/security/modx.tree.user.group.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

                  if (!this.windows.createUsergroup) {
                      this.windows.createUsergroup = MODx.load({
                          xtype: 'modx-window-usergroup-create'
                          ,listeners: {
                              'success': {fn:this.refresh,scope:this}
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 56..65

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

          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.windows.adduser) {
                      this.windows.adduser = MODx.load({
                          xtype: 'modx-window-usergroup-adduser'
                          ,listeners: {
                              'success': {fn:this.refresh,scope:this}
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 81..90

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

          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

                  },{
                      xtype: 'textfield'
                      ,fieldLabel: _('name')
                      ,description: MODx.expandHelp ? '' : _('user_group_desc_name')
                      ,name: 'name'
          manager/assets/modext/widgets/core/modx.grid.settings.js on lines 582..590

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 67.

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

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

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

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

          Refactorings

          Further Reading

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

                              ,items: [{
                                  xtype: 'textfield'
                                  ,name: 'aw_contexts'
                                  ,fieldLabel: _('contexts')
                                  ,description: MODx.expandHelp ? '' : _('user_group_aw_contexts_desc')
          manager/assets/modext/widgets/security/modx.tree.resource.group.js on lines 242..250

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

          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: 'textarea'
                      ,fieldLabel: _('description')
                      ,description: MODx.expandHelp ? '' : _('user_group_desc_description')
                      ,name: 'description'
          manager/assets/modext/widgets/core/modx.grid.settings.js on lines 570..577
          manager/assets/modext/widgets/core/modx.grid.settings.js on lines 622..629
          manager/assets/modext/widgets/windows.js on lines 331..338
          manager/assets/modext/widgets/windows.js on lines 344..351

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

                              },{
                                  boxLabel: _('user_group_aw_parallel')
                                  ,description: _('user_group_aw_parallel_desc')
                                  ,name: 'aw_parallel'
                                  ,id: this.ident+'-aw-parallel'
          manager/assets/modext/widgets/security/modx.tree.resource.group.js on lines 266..275
          manager/assets/modext/widgets/security/modx.tree.resource.group.js on lines 280..289
          manager/assets/modext/widgets/security/modx.tree.resource.group.js on lines 297..306

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

          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 (MODx.perm.usergroup_edit && ui.hasClass('pupdate')) {
                              m.push({
                                  text: _('user_group_update')
                                  ,handler: this.updateUserGroup
                              });
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 116..121

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

                          if (MODx.perm.usergroup_new && ui.hasClass('pcreate')) {
                              m.push({
                                  text: _('user_group_create')
                                  ,handler: this.createUserGroup
                              });
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 122..127

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

                              },{
                                  fieldLabel: _('user_group_aw_resource_groups')
                                  ,description: _('user_group_aw_resource_groups_desc')
                                  ,name: 'aw_resource_groups'
                                  ,id: this.ident+'-aw-resource-groups'
          Severity: Major
          Found in manager/assets/modext/widgets/security/modx.tree.user.group.js and 2 other locations - About 55 mins to fix
          manager/assets/modext/widgets/security/modx.tree.resource.group.js on lines 311..319
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 335..343

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 53.

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

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

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

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

          Refactorings

          Further Reading

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

                              },{
                                  fieldLabel: _('user_group_aw_categories')
                                  ,description: _('user_group_aw_categories_desc')
                                  ,name: 'aw_categories'
                                  ,id: this.ident+'-aw-categories'
          Severity: Major
          Found in manager/assets/modext/widgets/security/modx.tree.user.group.js and 2 other locations - About 55 mins to fix
          manager/assets/modext/widgets/security/modx.tree.resource.group.js on lines 311..319
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 271..279

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 53.

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

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

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

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

          Refactorings

          Further Reading

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

                          if (MODx.perm.usergroup_user_edit && ui.hasClass('padduser')) {
                              m.push({
                                  text: _('user_group_user_add')
                                  ,handler: this.addUser
                              });
          Severity: Minor
          Found in manager/assets/modext/widgets/security/modx.tree.user.group.js and 1 other location - About 30 mins to fix
          manager/assets/modext/widgets/security/modx.grid.message.js on lines 220..226

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 45.

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

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

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

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

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status