talho/openphin

View on GitHub
app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js

Summary

Maintainability
F
1 mo
Test Coverage

File GridView.js has 456 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Ext.ux.maximgb.tg.GridView = Ext.extend(Ext.grid.GridView, 
{   
    expanded_icon_class : 'ux-maximgb-tg-elbow-minus',
    last_expanded_icon_class : 'ux-maximgb-tg-elbow-end-minus',
    collapsed_icon_class : 'ux-maximgb-tg-elbow-plus',
Severity: Minor
Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 6 hrs to fix

    Function doRender has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        doRender : function(cs, rs, ds, startRow, colCount, stripe)
        {
            var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
            var tstyle = 'width:'+this.getTotalWidth()+';';
            // buffers
    Severity: Minor
    Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 5 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 renderCellTreeUI has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        renderCellTreeUI : function(record, store)
        {
            var tpl = this.templates.treeui,
                line_tpl = this.templates.elbow_line,
                tpl_data = {},
    Severity: Minor
    Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.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

    Function renderCellTreeUI has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        renderCellTreeUI : function(record, store)
        {
            var tpl = this.templates.treeui,
                line_tpl = this.templates.elbow_line,
                tpl_data = {},
    Severity: Major
    Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 2 hrs to fix

      Function doRender has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          doRender : function(cs, rs, ds, startRow, colCount, stripe)
          {
              var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
              var tstyle = 'width:'+this.getTotalWidth()+';';
              // buffers
      Severity: Major
      Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 2 hrs to fix

        Function initTemplates has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            initTemplates : function()
            {
                var ts = this.templates || {};
                
                if (!ts.row) {
        Severity: Minor
        Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 1 hr to fix

          Function expandRow has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              expandRow : function(record, skip_process)
              {
                  var ds = this.ds,
                      i, len, row, pmel, children, index, child_index;
                  
          Severity: Minor
          Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.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 expandRow has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              expandRow : function(record, skip_process)
              {
                  var ds = this.ds,
                      i, len, row, pmel, children, index, child_index;
                  
          Severity: Minor
          Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 1 hr to fix

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

                collapseRow : function(record, skip_process)
                {
                    var ds = this.ds,
                        i, len, children, row, index, child_index;
                            
            Severity: Minor
            Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 1 hr to fix

              Function updateAllColumnWidths has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  updateAllColumnWidths : function()
                  {
                      var tw = this.getTotalWidth(),
                      clen = this.cm.getColumnCount(),
                      ws = [],
              Severity: Minor
              Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.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 collapseRow has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  collapseRow : function(record, skip_process)
                  {
                      var ds = this.ds,
                          i, len, children, row, index, child_index;
                              
              Severity: Minor
              Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.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 updateColumnHidden has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  updateColumnHidden : function(col, hidden)
                  {
                      var tw = this.getTotalWidth();
                      this.innerHd.firstChild.style.width = this.getOffsetWidth();
                      this.innerHd.firstChild.firstChild.style.width = tw;
              Severity: Minor
              Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.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 updateAllColumnWidths has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  updateAllColumnWidths : function()
                  {
                      var tw = this.getTotalWidth(),
                      clen = this.cm.getColumnCount(),
                      ws = [],
              Severity: Minor
              Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 1 hr to fix

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

                    updateColumnWidth : function(col, width)
                    {
                        var w = this.getColumnWidth(col);
                        var tw = this.getTotalWidth();
                        this.innerHd.firstChild.style.width = this.getOffsetWidth();
                Severity: Minor
                Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.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 doRender has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    doRender : function(cs, rs, ds, startRow, colCount, stripe)
                Severity: Minor
                Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 45 mins to fix

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

                      renderRow : function(record, index, col_count, ds, total_width)
                  Severity: Minor
                  Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.js - About 35 mins to fix

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

                        initTemplates : function()
                        {
                            var ts = this.templates || {};
                            
                            if (!ts.row) {
                    Severity: Minor
                    Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.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 ensureVisible has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        ensureVisible : function(row, col, hscroll)
                        {
                            var ancestors, record = this.ds.getAt(row);
                            
                            if (!this.ds.isVisibleNode(record)) {
                    Severity: Minor
                    Found in app/assets/javascripts/ext_extensions/TreeGrid/src/GridView.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

                    Ext.ux.maximgb.tg.GridView = Ext.extend(Ext.grid.GridView, 
                    {   
                        expanded_icon_class : 'ux-maximgb-tg-elbow-minus',
                        last_expanded_icon_class : 'ux-maximgb-tg-elbow-end-minus',
                        collapsed_icon_class : 'ux-maximgb-tg-elbow-plus',
                    app/assets/javascripts/ext_extensions/TreeGrid/TreeGrid.js on lines 1116..1644

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

                    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