modxcms/revolution

View on GitHub
manager/assets/modext/workspace/lexicon/lexicon.grid.js

Summary

Maintainability
F
4 days
Test Coverage

File lexicon.grid.js has 413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Loads a grid for managing lexicons.
 *
 * @class MODx.grid.Lexicon
 * @extends MODx.grid.Grid
Severity: Minor
Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js - About 5 hrs to fix

    Function Lexicon has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    MODx.grid.Lexicon = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            id: 'modx-grid-lexicon'
            ,url: MODx.config.connector_url
    Severity: Major
    Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js - About 5 hrs to fix

      Function setFilterParams has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          ,setFilterParams: function(ns,t,l) {
              var tb = this.getTopToolbar();
              if (!tb) {return false;}
      
              var tcb,tcl;
      Severity: Minor
      Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js - About 3 hrs 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 LexiconEntryCreate has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      MODx.window.LexiconEntryCreate = function(config) {
          config = config || {};
          this.ident = config.ident || 'lexentc'+Ext.id();
          var r = config.record;
          Ext.applyIf(config,{
      Severity: Major
      Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js - About 2 hrs to fix

        Function ExportLexicon has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        MODx.window.ExportLexicon = function(config) {
            config = config || {};
            this.ident = config.ident || 'explex'+Ext.id();
            var r = config.record;
            Ext.applyIf(config,{
        Severity: Minor
        Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js - About 1 hr to fix

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

              ,setFilterParams: function(ns,t,l) {
                  var tb = this.getTopToolbar();
                  if (!tb) {return false;}
          
                  var tcb,tcl;
          Severity: Minor
          Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js - About 1 hr to fix

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

            MODx.grid.Lexicon = function(config) {
                config = config || {};
                Ext.applyIf(config,{
                    id: 'modx-grid-lexicon'
                    ,url: MODx.config.connector_url
            Severity: Minor
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.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

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

                    },{
                        xtype: 'modx-combo-namespace'
                        ,fieldLabel: _('namespace')
                        ,name: 'namespace'
                        ,id: 'modx-'+this.ident+'-namespace'
            Severity: Major
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 1 other location - About 6 hrs to fix
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 463..480

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

            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

                    },{
                        xtype: 'modx-combo-namespace'
                        ,fieldLabel: _('namespace')
                        ,name: 'namespace'
                        ,id: 'modx-'+this.ident+'-namespace'
            Severity: Major
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 1 other location - About 6 hrs to fix
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 407..424

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

            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

                ,_renderStatus: function(v,md,rec,ri) {
                    switch (rec.data.overridden) {
                        case 1:
                            return '<span style="color: green;">'+v+'</span>';break;
                        case 2:
            Severity: Major
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 2 other locations - About 1 hr to fix
            manager/assets/modext/widgets/element/modx.grid.element.properties.js on lines 208..217
            manager/assets/modext/widgets/source/modx.grid.source.properties.js on lines 92..101

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

            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

                    },{
                        xtype: 'modx-combo-lexicon-topic'
                        ,fieldLabel: _('topic')
                        ,name: 'topic'
                        ,id: 'modx-'+this.ident+'-topic'
            Severity: Major
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 3 other locations - About 40 mins to fix
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 424..431
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 431..438
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 487..494

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

            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

                    },{
                        xtype: 'modx-combo-lexicon-topic'
                        ,fieldLabel: _('topic')
                        ,name: 'topic'
                        ,id: 'modx-'+this.ident+'-topic'
            Severity: Major
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 3 other locations - About 40 mins to fix
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 431..438
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 480..487
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 487..494

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

            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

                    },{
                        xtype: 'modx-combo-language'
                        ,fieldLabel: _('language')
                        ,name: 'language'
                        ,id: 'modx-'+this.ident+'-language'
            Severity: Major
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 3 other locations - About 40 mins to fix
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 424..431
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 431..438
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 480..487

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

            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

                    },{
                        xtype: 'modx-combo-language'
                        ,fieldLabel: _('language')
                        ,name: 'language'
                        ,id: 'modx-'+this.ident+'-language'
            Severity: Major
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 3 other locations - About 40 mins to fix
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 424..431
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 480..487
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 487..494

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

            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: 'textarea'
                        ,fieldLabel: _('value')
                        ,id: 'modx-'+this.ident+'-value'
                        ,itemId: 'value'
            Severity: Minor
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 1 other location - About 40 mins to fix
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 456..463

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

            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

                    ,fields: [{
                        xtype: 'textfield'
                        ,fieldLabel: _('name')
                        ,id: 'modx-'+this.ident+'-name'
                        ,itemId: 'name'
            Severity: Minor
            Found in manager/assets/modext/workspace/lexicon/lexicon.grid.js and 1 other location - About 40 mins to fix
            manager/assets/modext/workspace/lexicon/lexicon.grid.js on lines 494..501

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

            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