modxcms/revolution

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

Summary

Maintainability
D
2 days
Test Coverage

Function CreateResourceGroup has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

    /**
     * Generates the Resource Group Tree in Ext
     * 
     * @class MODx.tree.ResourceGroup
     * @extends MODx.tree.Tree
    Severity: Minor
    Found in manager/assets/modext/widgets/security/modx.tree.resource.group.js - About 3 hrs to fix

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

          ,_handleDrag: function(dropEvent) {
              Ext.Msg.show({
                  title: _('please_wait')
                  ,msg: _('saving')
                  ,width: 240
      Severity: Minor
      Found in manager/assets/modext/widgets/security/modx.tree.resource.group.js - About 1 hr to fix

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

        MODx.window.CreateResourceGroup = function(config) {
            config = config || {};
            this.ident = config.ident || 'modx-crgrp'+Ext.id();
            Ext.applyIf(config,{
                title: _('resource_group_create')
        Severity: Minor
        Found in manager/assets/modext/widgets/security/modx.tree.resource.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

        Avoid too many return statements within this function.
        Open

                return a.leaf !== true;
        Severity: Major
        Found in manager/assets/modext/widgets/security/modx.tree.resource.group.js - About 30 mins to fix

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

                      },{
                          xtype: 'textfield'
                          ,name: 'access_contexts'
                          ,fieldLabel: _('contexts')
                          ,description: MODx.expandHelp ? '' : _('resource_group_access_contexts')
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 302..310

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

                              ,items: [{
                                  boxLabel: _('resource_group_access_parallel')
                                  ,description: _('resource_group_access_parallel_desc')
                                  ,name: 'access_parallel'
                                  ,id: this.ident+'-access-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.user.group.js on lines 285..294

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

                              },{
                                  boxLabel: _('resource_group_access_anon')
                                  ,description: _('resource_group_access_anon_desc')
                                  ,name: 'access_anon'
                                  ,id: this.ident+'-access-anon'
          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 297..306
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 285..294

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

                              ,items: [{
                                  boxLabel: _('resource_group_access_admin')
                                  ,description: _('resource_group_access_admin_desc')
                                  ,name: 'access_admin'
                                  ,id: this.ident+'-access-admin'
          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
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 285..294

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

                              },{
                                  fieldLabel: _('resource_group_access_ugs')
                                  ,description: _('resource_group_access_ugs_desc')
                                  ,name: 'access_usergroups'
                                  ,id: this.ident+'-access-usergroups'
          manager/assets/modext/widgets/security/modx.tree.user.group.js on lines 271..279
          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

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

                  Ext.Msg.show({
                      title: _('please_wait')
                      ,msg: _('saving')
                      ,width: 240
                      ,progress:true
          manager/assets/modext/widgets/core/modx.tree.column.js on lines 86..92

          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