modxcms/revolution

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

Summary

Maintainability
F
4 days
Test Coverage

Function getGeneralFields has 323 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    ,getGeneralFields: function(config) {
        var itemsRight = [{
            id: 'modx-user-newpassword'
            ,name: 'newpassword'
            ,xtype: 'hidden'
Severity: Major
Found in manager/assets/modext/widgets/security/modx.panel.user.js - About 1 day to fix

    File modx.panel.user.js has 582 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @class MODx.panel.User
     * @extends MODx.FormPanel
     * @param {Object} config An object of configuration properties
     * @xtype modx-panel-user
    Severity: Major
    Found in manager/assets/modext/widgets/security/modx.panel.user.js - About 1 day to fix

      Function getFields has 129 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ,getFields: function(config) {
              var f = [{
                  title: _('general_information')
                  ,defaults: { msgTarget: 'side' ,autoHeight: true }
                  ,cls: 'main-wrapper form-with-labels'
      Severity: Major
      Found in manager/assets/modext/widgets/security/modx.panel.user.js - About 5 hrs to fix

        Function User has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        MODx.panel.User = function(config) {
            config = config || {};
            Ext.applyIf(config,{
                url: MODx.config.connector_url
                ,baseParams: {}
        Severity: Minor
        Found in manager/assets/modext/widgets/security/modx.panel.user.js - About 1 hr to fix

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

              setup: function() {
                  if (this.config.user === '' || this.config.user === 0) {
                      this.fireEvent('ready');
                      return false;
                  }
          Severity: Minor
          Found in manager/assets/modext/widgets/security/modx.panel.user.js - About 1 hr to fix

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

                setup: function() {
                    if (this.config.user === '' || this.config.user === 0) {
                        this.fireEvent('ready');
                        return false;
                    }
            Severity: Minor
            Found in manager/assets/modext/widgets/security/modx.panel.user.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

            Function success has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                ,success: function(o) {
                    var userId = this.config.user;
                    if (Ext.getCmp('modx-user-passwordnotifymethod-s').getValue() === true && o.result.message != '') {
                        Ext.Msg.hide();
                        Ext.Msg.show({
            Severity: Minor
            Found in manager/assets/modext/widgets/security/modx.panel.user.js - About 25 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

                    },{
                        id: 'modx-user-blockedafter'
                        ,name: 'blockedafter'
                        ,fieldLabel: _('user_blockedafter')
                        ,description: _('user_blockedafter_desc')
            Severity: Major
            Found in manager/assets/modext/widgets/security/modx.panel.user.js and 1 other location - About 2 hrs to fix
            manager/assets/modext/widgets/security/modx.panel.user.js on lines 292..305

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

            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

                    itemsRight.push({
                        id: 'modx-user-blockeduntil'
                        ,name: 'blockeduntil'
                        ,fieldLabel: _('user_blockeduntil')
                        ,description: _('user_blockeduntil_desc')
            Severity: Major
            Found in manager/assets/modext/widgets/security/modx.panel.user.js and 1 other location - About 2 hrs to fix
            manager/assets/modext/widgets/security/modx.panel.user.js on lines 305..318

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

            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

                            ,'collapse': {fn:function(p) {
                                Ext.getCmp('modx-user-newpassword').setValue(false);
                                this.markDirty();
                            },scope:this}
            Severity: Minor
            Found in manager/assets/modext/widgets/security/modx.panel.user.js and 1 other location - About 50 mins to fix
            manager/assets/modext/widgets/security/modx.panel.user.js on lines 366..369

            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

                            'expand': {fn:function(p) {
                                Ext.getCmp('modx-user-newpassword').setValue(true);
                                this.markDirty();
                            },scope:this}
            Severity: Minor
            Found in manager/assets/modext/widgets/security/modx.panel.user.js and 1 other location - About 50 mins to fix
            manager/assets/modext/widgets/security/modx.panel.user.js on lines 370..373

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

                    if (this.config.user === '' || this.config.user === 0) {
                        this.fireEvent('ready');
                        return false;
                    }
            Severity: Major
            Found in manager/assets/modext/widgets/security/modx.panel.user.js and 3 other locations - About 40 mins to fix
            manager/assets/modext/widgets/resource/modx.panel.resource.data.js on lines 188..191
            manager/assets/modext/widgets/security/modx.panel.access.policy.js on lines 120..123
            manager/assets/modext/widgets/security/modx.panel.access.policy.template.js on lines 125..128

            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

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

                    },{
                        id: 'modx-user-blocked'
                        ,name: 'blocked'
                        ,hideLabel: true
                        ,boxLabel: _('user_block')
            Severity: Minor
            Found in manager/assets/modext/widgets/security/modx.panel.user.js and 1 other location - About 30 mins to fix
            manager/assets/modext/widgets/security/modx.panel.user.js on lines 263..271

            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

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

                    },{
                        id: 'modx-user-active'
                        ,name: 'active'
                        ,hideLabel: true
                        ,boxLabel: _('active')
            Severity: Minor
            Found in manager/assets/modext/widgets/security/modx.panel.user.js and 1 other location - About 30 mins to fix
            manager/assets/modext/widgets/security/modx.panel.user.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 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