talho/openphin

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

Summary

Maintainability
D
2 days
Test Coverage

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

    constructor: function(cfg) {
        var me = this,
            items = cfg.items || (me.items = [me]),
            l = items.length,
            i,
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/grid/Column.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 processEvent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    processEvent : function(name, e, grid, rowIndex, colIndex){
        var m = e.getTarget().className.match(this.actionIdRe),
            item, fn;
        if (m && (item = this.items[parseInt(m[1], 10)])) {
            if (name == 'click') {
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/grid/Column.js - About 45 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 processEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    processEvent : function(name, e, grid, rowIndex, colIndex){
Severity: Minor
Found in app/assets/javascripts/ext/src/widgets/grid/Column.js - About 35 mins to fix

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

        processEvent : function(name, e, grid, rowIndex, colIndex){
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/grid/Column.js - About 35 mins to fix

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

          setEditor : function(editor){
              var ed = this.editor;
              if(ed){
                  if(ed.gridEditor){
                      ed.gridEditor.destroy();
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/grid/Column.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 getCellEditor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          getCellEditor: function(rowIndex){
              var ed = this.getEditor(rowIndex);
              if(ed){
                  if(!ed.startEdit){
                      if(!ed.gridEditor){
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/grid/Column.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

                      v += '<img alt="' + me.altText + '" src="' + (item.icon || Ext.BLANK_IMAGE_URL) +
                          '" class="x-action-col-icon x-action-col-' + String(i) + ' ' + (item.iconCls || '') +
                          ' ' + (Ext.isFunction(item.getClass) ? item.getClass.apply(item.scope||this.scope||this, arguments) : '') + '"' +
                          ((item.tooltip) ? ' ext:qtip="' + item.tooltip + '"' : '') + ' />';
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/grid/Column.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/ext_extensions/xActionColumn.js on lines 151..154

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

      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

      Ext.grid.DateColumn = Ext.extend(Ext.grid.Column, {
          /**
           * @cfg {String} format
           * A formatting string as used by {@link Date#format} to format a Date for this Column
           * (defaults to <tt>'m/d/Y'</tt>).
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/grid/Column.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/ext/src/widgets/grid/Column.js on lines 413..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 114.

      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

      Ext.grid.NumberColumn = Ext.extend(Ext.grid.Column, {
          /**
           * @cfg {String} format
           * A formatting string as used by {@link Ext.util.Format#number} to format a numeric value for this Column
           * (defaults to <tt>'0,000.00'</tt>).
      Severity: Major
      Found in app/assets/javascripts/ext/src/widgets/grid/Column.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/ext/src/widgets/grid/Column.js on lines 433..444

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

      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

              this.renderer = function(v){
                  if(v === undefined){
                      return u;
                  }
                  if(!v || v === 'false'){
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/grid/Column.js and 1 other location - About 30 mins to fix
      app/assets/javascripts/ext/src/widgets/list/Column.js on lines 144..152

      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

              var me = this,
                  items = cfg.items || (me.items = [me]),
                  l = items.length,
                  i,
                  item;
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/grid/Column.js and 1 other location - About 30 mins to fix
      app/assets/javascripts/ext_extensions/xActionColumn.js on lines 111..115

      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