sodabrew/puppet-dashboard

View on GitHub
app/assets/javascripts/jqplot.categoryAxisRenderer.js

Summary

Maintainability
F
2 wks
Test Coverage

Function pack has 206 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.jqplot.CategoryAxisRenderer.prototype.pack = function(pos, offsets) {
        var ticks = this._ticks;
        var max = this.max;
        var min = this.min;
        var offmax = offsets.max;
Severity: Major
Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 1 day to fix

    File jqplot.categoryAxisRenderer.js has 508 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * jqPlot
     * Pure JavaScript plotting plugin using jQuery
     *
     * Version: 1.0.8
    Severity: Major
    Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 1 day to fix

      Function createTicks has 149 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.jqplot.CategoryAxisRenderer.prototype.createTicks = function() {
              // we're are operating on an axis here
              var ticks = this._ticks;
              var userTicks = this.ticks;
              var name = this.name;
      Severity: Major
      Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 5 hrs to fix

        Function set has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.jqplot.CategoryAxisRenderer.prototype.set = function() { 
                var dim = 0;
                var temp;
                var w = 0;
                var h = 0;
        Severity: Major
        Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 2 hrs to fix

          Function draw has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $.jqplot.CategoryAxisRenderer.prototype.draw = function(ctx, plot) {
                  if (this.show) {
                      // populate the axis label and value properties.
                      // createTicks is a method on the renderer, but
                      // call it within the scope of the axis.
          Severity: Minor
          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 1 hr to fix

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

                $.jqplot.CategoryAxisRenderer.prototype.init = function(options){
                    this.groups = 1;
                    this.groupLabels = [];
                    this._groupLabels = [];
                    this._grouped = false;
            Severity: Minor
            Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (this._ticks[j]._elem && this._ticks[j].label != " ") {
                                          var t = this._ticks[j]._elem;
                                          var p = t.position();
                                          mid += p.top + t.outerHeight()/2;
                                          count++;
              Severity: Major
              Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (j >= this._ticks.length-1) continue; // the last tick does not exist as there is no other group in order to have an empty one.
                Severity: Major
                Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
                                              // will need to adjust auto positioning based on which axis this is.
                                              var temp = (this.name == 'xaxis') ? 1 : -1;
                                              switch (t.labelPosition) {
                                                  case 'auto':
                  Severity: Major
                  Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
                                                // will need to adjust auto positioning based on which axis this is.
                                                var temp = (this.name == 'yaxis') ? 1 : -1;
                                                switch (t.labelPosition) {
                                                    case 'auto':
                    Severity: Major
                    Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (this._ticks[j]._elem && this._ticks[j].label != " ") {
                                                  var t = this._ticks[j]._elem;
                                                  var p = t.position();
                                                  mid += p.left + t.outerWidth(true)/2;
                                                  count++;
                      Severity: Major
                      Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (j >= this._ticks.length-1) continue; // the last tick does not exist as there is no other group in order to have an empty one.
                        Severity: Major
                        Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js - About 45 mins to fix

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

                                          for (i=0; i<ticks.length; i++) {
                                              var t = ticks[i];
                                              if (t.show && t.showLabel) {
                                                  var shim;
                                                  
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 3 days to fix
                          app/assets/javascripts/jquery.jqplot.js on lines 6917..6957

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

                          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

                                          for (i=0; i<ticks.length; i++) {
                                              var t = ticks[i];
                                              if (t.show && t.showLabel) {                        
                                                  var shim;
                                                  if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 2 days to fix
                          app/assets/javascripts/jquery.jqplot.js on lines 6971..7019

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

                          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.name == 'xaxis') {
                                          dim += dim2 + h;
                                          this._elem.css({'height':dim+'px', left:'0px', bottom:'0px'});
                                      }
                                      else if (this.name == 'x2axis') {
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 1 day to fix
                          app/assets/javascripts/jquery.jqplot.js on lines 6241..6262

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

                          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 (lshow) {
                                              var w = this._label._elem.outerWidth(true);
                                              this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px');
                                              if (this.name == 'xaxis') {
                                                  this._label._elem.css('bottom', '0px');
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 1 day to fix
                          app/assets/javascripts/jqplot.categoryAxisRenderer.js on lines 641..653

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

                          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 (lshow) {
                                              var h = this._label._elem.outerHeight(true);
                                              this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
                                              if (this.name == 'yaxis') {
                                                  this._label._elem.css('left', '0px');
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 1 day to fix
                          app/assets/javascripts/jqplot.categoryAxisRenderer.js on lines 556..568

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

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

                                      if (this.name == 'xaxis' || this.name == 'x2axis'){
                                          this.series_u2p = function(u){
                                              return (max - u) * pixellength / unitlength;
                                          };
                                          this.series_p2u = function(p){
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 2 other locations - About 6 hrs to fix
                          app/assets/javascripts/jqplot.categoryAxisRenderer.js on lines 460..476
                          app/assets/javascripts/jquery.jqplot.js on lines 6896..6912

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

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

                                      if (this.name == 'xaxis' || this.name == 'x2axis'){
                                          this.series_u2p = function(u){
                                              return (u - min) * pixellength / unitlength;
                                          };
                                          this.series_p2u = function(p){
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 2 other locations - About 6 hrs to fix
                          app/assets/javascripts/jqplot.categoryAxisRenderer.js on lines 490..506
                          app/assets/javascripts/jquery.jqplot.js on lines 6896..6912

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

                          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.name == 'xaxis' || this.name == 'x2axis') {
                                              if (d[j][0] < db.min || db.min == null) {
                                                  db.min = d[j][0];
                                              }
                                              if (d[j][0] > db.max || db.max == null) {
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 3 hrs to fix
                          app/assets/javascripts/jqplot.categoryAxisRenderer.js on lines 99..106

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

                          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

                                          else {
                                              if (d[j][1] < db.min || db.min == null) {
                                                  db.min = d[j][1];
                                              }
                                              if (d[j][1] > db.max || db.max == null) {
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 3 hrs to fix
                          app/assets/javascripts/jqplot.categoryAxisRenderer.js on lines 91..98

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

                          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

                                          if (tick.showLabel && (!tick.isMinorTick || this.showMinorTicks)) {
                                              if (this.name == 'xaxis' || this.name == 'x2axis') {
                                                  temp = tick._elem.outerHeight(true);
                                              }
                                              else {
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 2 hrs to fix
                          app/assets/javascripts/jquery.jqplot.js on lines 6222..6232

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

                          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

                                      if (this.name == 'xaxis' || this.name == 'x2axis') {
                                          this._elem.width(this._plotDimensions.width);
                                      }
                                      else {
                                          this._elem.height(this._plotDimensions.height);
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 2 hrs to fix
                          app/assets/javascripts/jquery.jqplot.js on lines 6166..6171

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

                          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

                                      if (lshow) {
                                          w = this._label._elem.outerWidth(true);
                                          h = this._label._elem.outerHeight(true); 
                                      }
                          Severity: Minor
                          Found in app/assets/javascripts/jqplot.categoryAxisRenderer.js and 1 other location - About 55 mins to fix
                          app/assets/javascripts/jquery.jqplot.js on lines 6237..6240

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

                          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