sodabrew/puppet-dashboard

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

Summary

Maintainability
F
1 wk
Test Coverage

File jqplot.barRenderer.js has 605 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.barRenderer.js - About 1 day to fix

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

        $.jqplot.BarRenderer.prototype.draw = function(ctx, gridData, options, plot) {
            var i;
            // Ughhh, have to make a copy of options b/c it may be modified later.
            var opts = $.extend({}, options);
            var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
    Severity: Major
    Found in app/assets/javascripts/jqplot.barRenderer.js - About 1 day to fix

      Function drawShadow has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.jqplot.BarRenderer.prototype.drawShadow = function(ctx, gridData, options, plot) {
              var i;
              var opts = (options != undefined) ? options : {};
              var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
              var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
      Severity: Major
      Found in app/assets/javascripts/jqplot.barRenderer.js - About 3 hrs to fix

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

            $.jqplot.BarRenderer.prototype.init = function(options, plot) {
                // Group: Properties
                //
                // prop: barPadding
                // Number of pixels between adjacent bars at the same axis value.
        Severity: Major
        Found in app/assets/javascripts/jqplot.barRenderer.js - About 2 hrs to fix

          Function barPreInit has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function barPreInit(target, data, seriesDefaults, options) {
                  if (this.rendererOptions.barDirection == 'horizontal') {
                      this._stackAxis = 'x';
                      this._primaryAxis = '_yaxis';
                  }
          Severity: Minor
          Found in app/assets/javascripts/jqplot.barRenderer.js - About 1 hr to fix

            Function setBarWidth has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.jqplot.BarRenderer.prototype.setBarWidth = function() {
                    // need to know how many data values we have on the approprate axis and figure it out.
                    var i;
                    var nvals = 0;
                    var nseries = 0;
            Severity: Minor
            Found in app/assets/javascripts/jqplot.barRenderer.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (this.varyBarColor && !this._stack) {
                                          if (this.useNegativeColors) {
                                              opts.fillStyle = negativeColors.next();
                                          }
                                          else {
              Severity: Major
              Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if (!this._stack && this.data[i][0] == null) {
                                        continue;
                                    }
                Severity: Major
                Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (this.fillToZero) {
                                              ystart = this._yaxis.series_u2p(0);
                                          }
                                          else if (this.waterfall && i > 0 && i < this.gridData.length-1) {
                                              ystart = this.gridData[i-1][1];
                  Severity: Major
                  Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (this.data[i][1] == null) {
                                                continue;
                                            }
                    Severity: Major
                    Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (shadow && !this._stack) {
                                              var sopts = $.extend(true, {}, opts);
                                              delete sopts.fillStyle;
                                              this.renderer.shadowRenderer.draw(ctx, points, sopts);
                                          }
                      Severity: Major
                      Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (this._stack && this._prevGridData.length) {
                                                    ystart = getStart(this.index, i, this._plotData[i][1], plot, 'y');
                                                }
                                                else {
                                                    if (this.fillToZero) {
                        Severity: Major
                        Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (this.varyBarColor && !this._stack) {
                                                      opts.fillStyle = positiveColors.next();
                                                  }
                                                  else {
                                                      opts.fillStyle = positiveColor;
                          Severity: Major
                          Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if ((this.fillToZero && this._plotData[i][0] < 0) || (this.waterfall && this._data[i][0] < 0)) {
                                                    if (this.varyBarColor && !this._stack) {
                                                        if (this.useNegativeColors) {
                                                            opts.fillStyle = negativeColors.next();
                                                        }
                            Severity: Major
                            Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if (!this.fillToZero || this._plotData[i][0] >= 0) {
                                                      points.push([xstart, base + this.barWidth / 2]);
                                                      points.push([xstart, base - this.barWidth / 2]);
                                                      points.push([gridData[i][0], base - this.barWidth / 2]);
                                                      points.push([gridData[i][0], base + this.barWidth / 2]);
                              Severity: Major
                              Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    for (var i=0; i<gridData.length; i++) {
                                                        if (this.data[i][0] == null) {
                                                            continue;
                                                        }
                                                        points = [];
                                Severity: Major
                                Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if (this._stack && this._prevGridData.length) {
                                                          xstart = getStart(this.index, i, this._plotData[i][0], plot, 'x');
                                                      }
                                                      // not stacked
                                                      else {
                                  Severity: Major
                                  Found in app/assets/javascripts/jqplot.barRenderer.js - About 45 mins to fix

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

                                        function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
                                    Severity: Minor
                                    Found in app/assets/javascripts/jqplot.barRenderer.js - About 35 mins to fix

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

                                          function getStart(sidx, didx, comp, plot, axis) {
                                      Severity: Minor
                                      Found in app/assets/javascripts/jqplot.barRenderer.js - About 35 mins to fix

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

                                            function handleMove(ev, gridpos, datapos, neighbor, plot) {
                                        Severity: Minor
                                        Found in app/assets/javascripts/jqplot.barRenderer.js - About 35 mins to fix

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

                                              function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
                                          Severity: Minor
                                          Found in app/assets/javascripts/jqplot.barRenderer.js - About 35 mins to fix

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

                                                function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
                                            Severity: Minor
                                            Found in app/assets/javascripts/jqplot.barRenderer.js - About 35 mins to fix

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

                                                  function handleClick(ev, gridpos, datapos, neighbor, plot) {
                                              Severity: Minor
                                              Found in app/assets/javascripts/jqplot.barRenderer.js - About 35 mins to fix

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

                                                                    if ((this.fillToZero && this._plotData[i][1] < 0) || (this.waterfall && this._data[i][1] < 0)) {
                                                                        if (this.varyBarColor && !this._stack) {
                                                                            if (this.useNegativeColors) {
                                                                                opts.fillStyle = negativeColors.next();
                                                                            }
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 1 day to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 516..536

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

                                                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.fillToZero && this._plotData[i][0] < 0) || (this.waterfall && this._data[i][0] < 0)) {
                                                                        if (this.varyBarColor && !this._stack) {
                                                                            if (this.useNegativeColors) {
                                                                                opts.fillStyle = negativeColors.next();
                                                                            }
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 1 day to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 420..440

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

                                                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

                                                    function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
                                                        if (neighbor) {
                                                            var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
                                                            var idx = plot.plugins.barRenderer.highlightedSeriesIndex;
                                                            if (idx != null && plot.series[idx].highlightMouseDown) {
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 6 hrs to fix
                                                app/assets/javascripts/jquery.jqplot.js on lines 6046..6059

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

                                                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

                                                    function unhighlight (plot) {
                                                        var canvas = plot.plugins.barRenderer.highlightCanvas;
                                                        canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
                                                        for (var i=0; i<plot.series.length; i++) {
                                                            plot.series[i]._highlightedPoint = null;
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 6 hrs to fix
                                                app/assets/javascripts/jquery.jqplot.js on lines 5978..5987

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

                                                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 (paxis.name == 'xaxis' || paxis.name == 'x2axis') {
                                                            if (this._stack) {
                                                                this.barWidth = (paxis._offsets.max - paxis._offsets.min) / nvals * nseries - this.barMargin;
                                                            }
                                                            else {
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 4 hrs to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 267..275

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

                                                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 (this._stack) {
                                                                this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals * nseries - this.barMargin;
                                                            }
                                                            else {
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 4 hrs to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 258..266

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

                                                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

                                                    function handleClick(ev, gridpos, datapos, neighbor, plot) {
                                                        if (neighbor) {
                                                            var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
                                                            var evt = jQuery.Event('jqplotDataClick');
                                                            evt.which = ev.which;
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 4 hrs to fix
                                                app/assets/javascripts/jquery.jqplot.js on lines 6035..6044

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

                                                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

                                                    function postInit(target, data, options) {
                                                        for (var i=0; i<this.series.length; i++) {
                                                            if (this.series[i].renderer.constructor == $.jqplot.BarRenderer) {
                                                                // don't allow mouseover and mousedown at same time.
                                                                if (this.series[i].highlightMouseOver) {
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 3 hrs to fix
                                                app/assets/javascripts/jquery.jqplot.js on lines 5934..5943

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

                                                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

                                                                        else if (this.waterfall && i == 0 && i < this.gridData.length-1) {
                                                                            if (this._yaxis.min <= 0 && this._yaxis.max >= 0) {
                                                                                ystart = this._yaxis.series_u2p(0);
                                                                            }
                                                                            else if (this._yaxis.min > 0) {
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 3 hrs to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 405..418

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

                                                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

                                                                        else if (this.waterfall && i == this.gridData.length - 1) {
                                                                            if (this._yaxis.min <= 0 && this._yaxis.max >= 0) {
                                                                                ystart = this._yaxis.series_u2p(0);
                                                                            }
                                                                            else if (this._yaxis.min > 0) {
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 3 hrs to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 394..418

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

                                                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._stack) {
                                                            this._barNudge = 0;
                                                        }
                                                        else {
                                                            this._barNudge = (-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 2 hrs to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 605..610

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

                                                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._stack) {
                                                                this._barNudge = 0;
                                                            }
                                                            else {
                                                                this._barNudge = (-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 2 hrs to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 355..360

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

                                                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.plugins.barRenderer && this.plugins.barRenderer.highlightCanvas) {
                                                
                                                            this.plugins.barRenderer.highlightCanvas.resetCanvas();
                                                            this.plugins.barRenderer.highlightCanvas = null;
                                                        }
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 2 other locations - About 1 hr to fix
                                                app/assets/javascripts/jqplot.highlighter.js on lines 185..188
                                                app/assets/javascripts/jquery.jqplot.js on lines 5950..5953

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

                                                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 {
                                                                    this.data[i][1] = i+1;
                                                                    this._plotData[i][1] = i+1;
                                                                    this._stackData[i][1] = i+1;
                                                                }
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 1 hr to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 206..210

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

                                                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._primaryAxis == '_xaxis') {
                                                                    this.data[i][0] = i+1;
                                                                    this._plotData[i][0] = i+1;
                                                                    this._stackData[i][0] = i+1;
                                                                }
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 1 hr to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 211..215

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

                                                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

                                                    function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
                                                        var idx = plot.plugins.barRenderer.highlightedSeriesIndex;
                                                        if (idx != null && plot.series[idx].highlightMouseDown) {
                                                            unhighlight(plot);
                                                        }
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 1 hr to fix
                                                app/assets/javascripts/jquery.jqplot.js on lines 6028..6033

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

                                                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

                                                            this._data[this._data.length] = (pos == 1) ? [this._data.length+1, sum] : [sum, this._data.length+1];
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 1 hr to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 191..191

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

                                                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

                                                            this.data[this.data.length] = (pos == 1) ? [this.data.length+1, sum] : [sum, this.data.length+1];
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 1 hr to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 192..192

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

                                                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 (plot.series[ins[0]].show && plot.series[ins[0]].highlightMouseOver &&
                                                                !(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
                                                Severity: Minor
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 50 mins to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 753..753

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

                                                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 (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
                                                Severity: Minor
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 50 mins to fix
                                                app/assets/javascripts/jqplot.barRenderer.js on lines 735..736

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

                                                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

                                                        this.eventCanvas._elem.before(this.plugins.barRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-barRenderer-highlight-canvas', this._plotDimensions, this));
                                                Severity: Major
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 2 other locations - About 45 mins to fix
                                                app/assets/javascripts/jqplot.highlighter.js on lines 197..197
                                                app/assets/javascripts/jquery.jqplot.js on lines 5958..5958

                                                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

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

                                                        this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
                                                Severity: Minor
                                                Found in app/assets/javascripts/jqplot.barRenderer.js and 1 other location - About 40 mins to fix
                                                app/assets/javascripts/jquery.jqplot.js on lines 5960..5960

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

                                                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