talho/openphin

View on GitHub
app/assets/javascripts/ext/src/widgets/chart/Chart.js

Summary

Maintainability
D
3 days
Test Coverage

File Chart.js has 426 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/chart/Chart.js - About 6 hrs to fix

    Function refresh has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        refresh : function(){
            if(this.fireEvent('beforerefresh', this) !== false){
                var styleChanged = false;
                // convert the store data into something YUI charts can understand
                var data = [], rs = this.store.data.items;
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/chart/Chart.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 refresh has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        refresh : function(){
            if(this.fireEvent('beforerefresh', this) !== false){
                var styleChanged = false;
                // convert the store data into something YUI charts can understand
                var data = [], rs = this.store.data.items;
    Severity: Minor
    Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js - About 1 hr to fix

      Function bindStore has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          bindStore : function(store, initial){
              if(!initial && this.store){
                  if(store !== this.store && this.store.autoDestroy){
                      this.store.destroy();
                  }else{
      Severity: Minor
      Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                if(prop == "style" && currentSeries.style !== null){
                                    clonedSeries.style = Ext.encode(currentSeries.style);
                                    styleChanged = true;
                                    //we don't want to modify the styles again next time
                                    //so null out the style property.
        Severity: Major
        Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js - About 45 mins to fix

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

              bindStore : function(store, initial){
                  if(!initial && this.store){
                      if(store !== this.store && this.store.autoDestroy){
                          this.store.destroy();
                      }else{
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.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 onSwfReady has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              onSwfReady : function(isReset){
                  Ext.chart.CartesianChart.superclass.onSwfReady.call(this, isReset);
                  this.labelFn = [];
                  if(this.xField){
                      this.setXField(this.xField);
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.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

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

              setYAxes : function(value){
                  var axis;
                  for(var i = 0; i < value.length; i++) {
                      axis = this.createAxis('yAxis' + i, value[i]);
                      this.swf.setVerticalAxis(axis);
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/ext/src/widgets/chart/Chart.js on lines 487..493

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

          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

              setXAxes : function(value){
                  var axis;
                  for(var i = 0; i < value.length; i++) {
                      axis = this.createAxis('xAxis' + i, value[i]);
                      this.swf.setHorizontalAxis(axis);
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/ext/src/widgets/chart/Chart.js on lines 500..506

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

          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

                  dataTip: {
                      padding: 5,
                      border: {
                          color: 0x99bbe8,
                          size:1
          Severity: Major
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/ext_extensions/FlashGraph.js on lines 18..23

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

          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

                  if(this.tipRenderer){
                      ref = this.getFunctionRef(this.tipRenderer);
                      this.setTipRenderer(ref.fn, ref.scope);
                  }
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js and 1 other location - About 45 mins to fix
          app/assets/javascripts/ext/src/widgets/chart/Chart.js on lines 288..291

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

          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

                  if(this.legendRenderer){
                      ref = this.getFunctionRef(this.legendRenderer);
                      this.setLegendRenderer(ref.fn, ref.scope);
                  }
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js and 1 other location - About 45 mins to fix
          app/assets/javascripts/ext/src/widgets/chart/Chart.js on lines 284..287

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

          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

              setXAxis : function(value){
                  this.xAxis = this.createAxis('xAxis', value);
                  this.swf.setHorizontalAxis(this.xAxis);
              },
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js and 1 other location - About 45 mins to fix
          app/assets/javascripts/ext/src/widgets/chart/Chart.js on lines 495..498

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

          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

              setYAxis : function(value){
                  this.yAxis = this.createAxis('yAxis', value);
                  this.swf.setVerticalAxis(this.yAxis);
              },
          Severity: Minor
          Found in app/assets/javascripts/ext/src/widgets/chart/Chart.js and 1 other location - About 45 mins to fix
          app/assets/javascripts/ext/src/widgets/chart/Chart.js on lines 482..485

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

          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