talho/openphin

View on GitHub
app/assets/javascripts/ext_extensions/RowEditor.js

Summary

Maintainability
F
3 days
Test Coverage

File RowEditor.js has 469 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_extensions/RowEditor.js - About 7 hrs to fix

    RowEditor has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    Ext.ux.grid.RowEditor = Ext.extend(Ext.Panel, {
        floating: true,
        shadow: false,
        layout: 'hbox',
        cls: 'x-small-editor',
    Severity: Minor
    Found in app/assets/javascripts/ext_extensions/RowEditor.js - About 3 hrs to fix

      Function startEditing has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          startEditing: function(rowIndex, doFocus){
              if(this.editing && this.isDirty()){
                  this.showTooltip(this.commitChangesText);
                  return;
              }
      Severity: Minor
      Found in app/assets/javascripts/ext_extensions/RowEditor.js - About 2 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 verifyLayout has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          verifyLayout: function(force){
              if(this.el && (this.isVisible() || force === true)){
                  var row = this.grid.getView().getRow(this.rowIndex);
                  this.setSize(Ext.fly(row).getWidth(), Ext.isIE ? Ext.fly(row).getHeight() + 9 : undefined);
                  var cm = this.grid.colModel, fields = this.items.items;
      Severity: Minor
      Found in app/assets/javascripts/ext_extensions/RowEditor.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 stopEditing has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          stopEditing : function(saveChanges){
              this.editing = false;
              if(!this.isVisible()){
                  return;
              }
      Severity: Minor
      Found in app/assets/javascripts/ext_extensions/RowEditor.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 init has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          init: function(grid){
              this.grid = grid;
              this.ownerCt = grid;
              if(this.clicksToEdit === 2){
                  grid.on('rowdblclick', this.onRowDblClick, this);
      Severity: Minor
      Found in app/assets/javascripts/ext_extensions/RowEditor.js - About 1 hr to fix

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

            startEditing: function(rowIndex, doFocus){
                if(this.editing && this.isDirty()){
                    this.showTooltip(this.commitChangesText);
                    return;
                }
        Severity: Minor
        Found in app/assets/javascripts/ext_extensions/RowEditor.js - About 1 hr to fix

          Function initFields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              initFields: function(){
                  var cm = this.grid.getColumnModel(), pm = Ext.layout.ContainerLayout.prototype.parseMargins;
                  this.removeAll(false);
                  for(var i = 0, len = cm.getColumnCount(); i < len; i++){
                      var c = cm.getColumnAt(i),
          Severity: Minor
          Found in app/assets/javascripts/ext_extensions/RowEditor.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 stopEditing has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              stopEditing : function(saveChanges){
                  this.editing = false;
                  if(!this.isVisible()){
                      return;
                  }
          Severity: Minor
          Found in app/assets/javascripts/ext_extensions/RowEditor.js - About 1 hr to fix

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

                showTooltip: function(msg){
                    if (this.showToolTips !== true){
                      return;
                    }
                    var t = this.tooltip;
            Severity: Minor
            Found in app/assets/javascripts/ext_extensions/RowEditor.js - About 1 hr to fix

              Function initFields has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  initFields: function(){
                      var cm = this.grid.getColumnModel(), pm = Ext.layout.ContainerLayout.prototype.parseMargins;
                      this.removeAll(false);
                      for(var i = 0, len = cm.getColumnCount(); i < len; i++){
                          var c = cm.getColumnAt(i),
              Severity: Minor
              Found in app/assets/javascripts/ext_extensions/RowEditor.js - About 1 hr to fix

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

                    doFocus: function(pt){
                        if(this.isVisible()){
                            var index = 0,
                                cm = this.grid.getColumnModel(),
                                c;
                Severity: Minor
                Found in app/assets/javascripts/ext_extensions/RowEditor.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 onRowClick has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    onRowClick: function(g, rowIndex, e){
                      if(this.isValid()) {
                        if(this.clicksToEdit == 'auto'){
                            var li = this.lastClickIndex;
                            this.lastClickIndex = rowIndex;
                Severity: Minor
                Found in app/assets/javascripts/ext_extensions/RowEditor.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 getTargetColumnIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    getTargetColumnIndex: function(pt){
                        var grid = this.grid,
                            v = grid.view,
                            x = pt.left,
                            cms = grid.colModel.config,
                Severity: Minor
                Found in app/assets/javascripts/ext_extensions/RowEditor.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

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

                    showTooltip: function(msg){
                        if (this.showToolTips !== true){
                          return;
                        }
                        var t = this.tooltip;
                Severity: Minor
                Found in app/assets/javascripts/ext_extensions/RowEditor.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

                There are no issues that match your filters.

                Category
                Status