talho/openphin

View on GitHub
app/assets/javascripts/ext/src/widgets/grid/GridPanel.js

Summary

Maintainability
D
3 days
Test Coverage

Function walkCells has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    walkCells : function(row, col, step, fn, scope){
        var cm    = this.colModel,
            clen  = cm.getColumnCount(),
            ds    = this.store,
            rlen  = ds.getCount(),
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js - About 4 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

File GridPanel.js has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Ext JS Library 3.3.0
 * Copyright(c) 2006-2010 Ext JS, Inc.
 * licensing@extjs.com
 * http://www.extjs.com/license
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js - About 3 hrs to fix

    Function applyState has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        applyState : function(state){
            var cm = this.colModel,
                cs = state.columns,
                store = this.store,
                s,
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.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 initComponent has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        initComponent : function() {
            Ext.grid.GridPanel.superclass.initComponent.call(this);
    
            if (this.columnLines) {
                this.cls = (this.cls || '') + ' x-grid-with-col-lines';
    Severity: Major
    Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js - About 2 hrs to fix

      GridPanel has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      Ext.grid.GridPanel = Ext.extend(Ext.Panel, {
          /**
           * @cfg {String} autoExpandColumn
           * <p>The <tt>{@link Ext.grid.Column#id id}</tt> of a {@link Ext.grid.Column column} in
           * this grid that should expand to fill unused space. This value specified here can not
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js - About 2 hrs to fix

        Function walkCells has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            walkCells : function(row, col, step, fn, scope){
                var cm    = this.colModel,
                    clen  = cm.getColumnCount(),
                    ds    = this.store,
                    rlen  = ds.getCount(),
        Severity: Minor
        Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js - About 1 hr to fix

          Function applyState has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              applyState : function(state){
                  var cm = this.colModel,
                      cs = state.columns,
                      store = this.store,
                      s,
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js - About 1 hr to fix

            Function getState has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                getState : function(){
                    var o = {columns: []},
                        store = this.store,
                        ss,
                        gs;
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.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 getState has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getState : function(){
                    var o = {columns: []},
                        store = this.store,
                        ss,
                        gs;
            Severity: Minor
            Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js - About 1 hr to fix

              Function walkCells has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  walkCells : function(row, col, step, fn, scope){
              Severity: Minor
              Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js - About 35 mins to fix

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

                    initComponent : function() {
                        Ext.grid.GridPanel.superclass.initComponent.call(this);
                
                        if (this.columnLines) {
                            this.cls = (this.cls || '') + ' x-grid-with-col-lines';
                Severity: Minor
                Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.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

                    getView : function() {
                        if (!this.view) {
                            this.view = new Ext.grid.GridView(this.viewConfig);
                        }
                        
                Severity: Major
                Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/ext/src/widgets/grid/PivotGrid.js on lines 325..331

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

                    getDragDropText : function(){
                        var count = this.selModel.getCount();
                        return String.format(this.ddText, count, count == 1 ? '' : 's');
                    }
                Severity: Minor
                Found in app/assets/javascripts/ext/src/widgets/grid/GridPanel.js and 1 other location - About 40 mins to fix
                app/assets/javascripts/ext/src/widgets/tree/TreePanel.js on lines 790..794

                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