creative-connections/aurelia-bodylight-plugin

View on GitHub
src/utils/dygraph.js

Summary

Maintainability
F
2 mos
Test Coverage

File dygraph.js has 5651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! @license Copyright 2011 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */
/**
 * @license
 * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)
 * MIT-licensed (http://opensource.org/licenses/MIT)
Severity: Major
Found in src/utils/dygraph.js - About 2 wks to fix

    Function _renderLineChart has a Cognitive Complexity of 121 (exceeds 5 allowed). Consider refactoring.
    Open

    DygraphCanvasRenderer.prototype._renderLineChart = function() {
        // TODO(danvk): use this.attr_ for many of these.
        var ctx = this.elementContext;
        var fillAlpha = this.attr_('fillAlpha');
        var errorBars = this.attr_("errorBars") || this.attr_("customBars");
    Severity: Minor
    Found in src/utils/dygraph.js - About 2 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function rollingAverage has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.prototype.rollingAverage = function(originalData, rollPeriod) {
        if (originalData.length < 2)
            return originalData;
        rollPeriod = Math.min(rollPeriod, originalData.length);
        var rollingData = [];
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function numericTicks has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.numericTicks = function (a, b, pixels, opts, dygraph, vals) {
        //console.log("nt a " + a + " b " + b + " vals " + vals);
        var pixels_per_tick = opts('pixelsPerLabel');
        var ticks = [];
        var i, j, tickV, nTicks;
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function Legend has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.Plugins.Legend = (function() {
    
        /*
    
    Current bits of jankiness:
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function gatherDatasets_ has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) {
        var boundaryIds = [];
        var cumulative_y = [];  // For stacked series.
        var datasets = [];
        var extremes = {};  // series name -> [low, high]
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _renderAxis has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
    Open

    DygraphCanvasRenderer.prototype._renderAxis = function() {
        if (!this.attr_('drawXAxis') && !this.attr_('drawYAxis')) return;
    
        // Round pixels to half-integer boundaries for crisper drawing.
        function halfUp(x)  { return Math.round(x) + 0.5; }
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function computeYAxisRanges_ has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.prototype.computeYAxisRanges_ = function (extremes) {
        // Build a map from axis number -> [list of series names]
        var seriesForAxis = [], series;
        for (series in this.seriesToAxisMap_) {
            if (!this.seriesToAxisMap_.hasOwnProperty(series)) continue;
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function computeCombinedSeriesAndLimits_ has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
    Open

    DygraphRangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() {
        var data = this.dygraph_.rawData_;
        var logscale = this.attr_('logscale');
    
        // Create a combined series (average of all series values).
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function parseCSV_ has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.prototype.parseCSV_ = function(data) {
        var ret = [];
        var lines = data.split("\n");
        var vals, j;
    
    
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function parseDataTable_ has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

    Dygraph.prototype.parseDataTable_ = function(data) {
        var shortTextForAnnotationNum = function(num) {
            // converts [0-9]+ [A-Z][a-z]*
            // example: 0=A, 1=B, 25=Z, 26=Aa, 27=Ab
            // and continues like.. Ba Bb .. Za .. Zz..Aaa...Zzz Aaaa Zzzz
    Severity: Minor
    Found in src/utils/dygraph.js - About 1 day to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function initInteraction_ has 227 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    DygraphRangeSelector.prototype.initInteraction_ = function() {
        var self = this;
        var topElem = this.isIE_ ? document : window;
        var xLast = 0;
        var handle = null;
    Severity: Major
    Found in src/utils/dygraph.js - About 1 day to fix

      Function RGBColor has 218 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function RGBColor(color_string)
      {
          this.ok = false;
      
          // strip any leading #
      Severity: Major
      Found in src/utils/dygraph.js - About 1 day to fix

        Function Legend has 181 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Dygraph.Plugins.Legend = (function() {
        
            /*
        
        Current bits of jankiness:
        Severity: Major
        Found in src/utils/dygraph.js - About 7 hrs to fix

          Function _renderLineChart has 162 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          DygraphCanvasRenderer.prototype._renderLineChart = function() {
              // TODO(danvk): use this.attr_ for many of these.
              var ctx = this.elementContext;
              var fillAlpha = this.attr_('fillAlpha');
              var errorBars = this.attr_("errorBars") || this.attr_("customBars");
          Severity: Major
          Found in src/utils/dygraph.js - About 6 hrs to fix

            Function computeYAxes_ has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

            Dygraph.prototype.computeYAxes_ = function() {
                // Preserve valueWindow settings if they exist, and if the user hasn't
                // specified a new valueRange.
                var i, valueWindows, seriesName, axis, index, opts, v;
                if (this.axes_ !== undefined && this.user_attrs_.hasOwnProperty("valueRange") === false) {
            Severity: Minor
            Found in src/utils/dygraph.js - About 6 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _drawSeries has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

            DygraphCanvasRenderer.prototype._drawSeries = function(
                ctx, iter, strokeWidth, pointSize, drawPoints, drawGapPoints,
                stepPlot, strategy) {
            
                var prevCanvasX = null;
            Severity: Minor
            Found in src/utils/dygraph.js - About 6 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function getDateAxis has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

            Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) {
                var formatter = opts("axisLabelFormatter");
                var ticks = [];
                var t;
            
            
            Severity: Minor
            Found in src/utils/dygraph.js - About 6 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function _renderAxis has 135 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            DygraphCanvasRenderer.prototype._renderAxis = function() {
                if (!this.attr_('drawXAxis') && !this.attr_('drawYAxis')) return;
            
                // Round pixels to half-integer boundaries for crisper drawing.
                function halfUp(x)  { return Math.round(x) + 0.5; }
            Severity: Major
            Found in src/utils/dygraph.js - About 5 hrs to fix

              Function numericTicks has 123 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Dygraph.numericTicks = function (a, b, pixels, opts, dygraph, vals) {
                  //console.log("nt a " + a + " b " + b + " vals " + vals);
                  var pixels_per_tick = opts('pixelsPerLabel');
                  var ticks = [];
                  var i, j, tickV, nTicks;
              Severity: Major
              Found in src/utils/dygraph.js - About 4 hrs to fix

                Function _renderAnnotations has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                Open

                DygraphCanvasRenderer.prototype._renderAnnotations = function() {
                    var annotationStyle = {
                        "position": "absolute",
                        "fontSize": this.attr_('axisLabelFontSize') + "px",
                        "zIndex": 10,
                Severity: Minor
                Found in src/utils/dygraph.js - About 4 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function rollingAverage has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Dygraph.prototype.rollingAverage = function(originalData, rollPeriod) {
                    if (originalData.length < 2)
                        return originalData;
                    rollPeriod = Math.min(rollPeriod, originalData.length);
                    var rollingData = [];
                Severity: Major
                Found in src/utils/dygraph.js - About 4 hrs to fix

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

                  Dygraph.prototype.extremeValues_ = function(series) {
                      var minY = null, maxY = null, j, y;
                  
                      var bars = this.attr_("errorBars") || this.attr_("customBars");
                      if (bars) {
                  Severity: Minor
                  Found in src/utils/dygraph.js - About 4 hrs to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function parseDataTable_ has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Dygraph.prototype.parseDataTable_ = function(data) {
                      var shortTextForAnnotationNum = function(num) {
                          // converts [0-9]+ [A-Z][a-z]*
                          // example: 0=A, 1=B, 25=Z, 26=Aa, 27=Ab
                          // and continues like.. Ba Bb .. Za .. Zz..Aaa...Zzz Aaaa Zzzz
                  Severity: Major
                  Found in src/utils/dygraph.js - About 4 hrs to fix

                    Function parseCSV_ has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Dygraph.prototype.parseCSV_ = function(data) {
                        var ret = [];
                        var lines = data.split("\n");
                        var vals, j;
                    
                    
                    Severity: Major
                    Found in src/utils/dygraph.js - About 4 hrs to fix

                      Function doUnzoom_ has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Dygraph.prototype.doUnzoom_ = function() {
                          var dirty = false, dirtyX = false, dirtyY = false;
                          if (this.dateWindow_ !== null) {
                              dirty = true;
                              dirtyX = true;
                      Severity: Minor
                      Found in src/utils/dygraph.js - About 4 hrs to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function _evaluateLimits has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                      DygraphLayout.prototype._evaluateLimits = function () {
                          //TODO(tomaton): fix xrange when last x value is not the highest in case of x = sin(y) x is from 0 to 1 and back to 0
                          //and range for x is 0 to 1
                          this.minxval = this.maxxval = null;
                          if (this.dateWindow_) {
                      Severity: Minor
                      Found in src/utils/dygraph.js - About 4 hrs to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function isPixelChangingOptionList has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Dygraph.isPixelChangingOptionList = function(labels, attrs) {
                          // A whitelist of options that do not change pixel positions.
                          var pixelSafeOptions = {
                              'annotationClickHandler': true,
                              'annotationDblClickHandler': true,
                      Severity: Minor
                      Found in src/utils/dygraph.js - About 3 hrs to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function computeCombinedSeriesAndLimits_ has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      DygraphRangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() {
                          var data = this.dygraph_.rawData_;
                          var logscale = this.attr_('logscale');
                      
                          // Create a combined series (average of all series values).
                      Severity: Major
                      Found in src/utils/dygraph.js - About 3 hrs to fix

                        Function _renderChartLabels has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        DygraphCanvasRenderer.prototype._renderChartLabels = function() {
                            var div, class_div;
                        
                            // Generate divs for the chart title, xlabel and ylabel.
                            // Space for these divs has already been taken away from the charting area in
                        Severity: Major
                        Found in src/utils/dygraph.js - About 3 hrs to fix

                          Function updateSelection_ has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Dygraph.prototype.updateSelection_ = function(opt_animFraction) {
                              var defaultPrevented = this.cascadeEvents_('select', {
                                  selectedX: this.lastx_,
                                  selectedPoints: this.selPoints_
                              });
                          Severity: Minor
                          Found in src/utils/dygraph.js - About 3 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function setSelection has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Dygraph.prototype.setSelection = function(row, opt_seriesName) {
                              // Extract the points we've selected
                              this.selPoints_ = [];
                              var pos = 0;
                          
                          
                          Severity: Minor
                          Found in src/utils/dygraph.js - About 3 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function __init__ has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Dygraph.prototype.__init__ = function (div, file, attrs) {
                              // Hack for IE: if we're using excanvas and the document hasn't finished
                              // loading yet (and hence may not have initialized whatever it needs to
                              // initialize), then keep calling this routine periodically until it has.
                              if (/MSIE/.test(navigator.userAgent) && !window.opera &&
                          Severity: Minor
                          Found in src/utils/dygraph.js - About 3 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function findStackedPoint has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                          Dygraph.prototype.findStackedPoint = function(domX, domY) {
                              var row = this.findClosestRow(domX);
                              var boundary = this.getLeftBoundary_();
                              var rowIdx = row - boundary;
                              var points = this.layout_.points;
                          Severity: Minor
                          Found in src/utils/dygraph.js - About 3 hrs to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function gatherDatasets_ has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Dygraph.prototype.gatherDatasets_ = function(rolledSeries, dateWindow) {
                              var boundaryIds = [];
                              var cumulative_y = [];  // For stacked series.
                              var datasets = [];
                              var extremes = {};  // series name -> [low, high]
                          Severity: Major
                          Found in src/utils/dygraph.js - About 3 hrs to fix

                            Function _renderAnnotations has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            DygraphCanvasRenderer.prototype._renderAnnotations = function() {
                                var annotationStyle = {
                                    "position": "absolute",
                                    "fontSize": this.attr_('axisLabelFontSize') + "px",
                                    "zIndex": 10,
                            Severity: Major
                            Found in src/utils/dygraph.js - About 3 hrs to fix

                              Function __init__ has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              Dygraph.prototype.__init__ = function (div, file, attrs) {
                                  // Hack for IE: if we're using excanvas and the document hasn't finished
                                  // loading yet (and hence may not have initialized whatever it needs to
                                  // initialize), then keep calling this routine periodically until it has.
                                  if (/MSIE/.test(navigator.userAgent) && !window.opera &&
                              Severity: Major
                              Found in src/utils/dygraph.js - About 3 hrs to fix

                                Function movePan has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                                Open

                                Dygraph.Interaction.movePan = function(event, g, context) {
                                    context.dragEndX = g.dragGetX_(event, context);
                                    context.dragEndY = g.dragGetY_(event, context);
                                
                                    var minDate = context.initialLeftmostDate -
                                Severity: Minor
                                Found in src/utils/dygraph.js - About 3 hrs to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function computeYAxisRanges_ has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                Dygraph.prototype.computeYAxisRanges_ = function (extremes) {
                                    // Build a map from axis number -> [list of series names]
                                    var seriesForAxis = [], series;
                                    for (series in this.seriesToAxisMap_) {
                                        if (!this.seriesToAxisMap_.hasOwnProperty(series)) continue;
                                Severity: Major
                                Found in src/utils/dygraph.js - About 3 hrs to fix

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

                                  Dygraph.isPixelChangingOptionList = function(labels, attrs) {
                                      // A whitelist of options that do not change pixel positions.
                                      var pixelSafeOptions = {
                                          'annotationClickHandler': true,
                                          'annotationDblClickHandler': true,
                                  Severity: Major
                                  Found in src/utils/dygraph.js - About 3 hrs to fix

                                    Function computeYAxes_ has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    Dygraph.prototype.computeYAxes_ = function() {
                                        // Preserve valueWindow settings if they exist, and if the user hasn't
                                        // specified a new valueRange.
                                        var i, valueWindows, seriesName, axis, index, opts, v;
                                        if (this.axes_ !== undefined && this.user_attrs_.hasOwnProperty("valueRange") === false) {
                                    Severity: Major
                                    Found in src/utils/dygraph.js - About 3 hrs to fix

                                      Function updateDeep has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      Dygraph.updateDeep = function (self, o) {
                                          // Taken from http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
                                          function isNode(o) {
                                              return (
                                                  typeof Node === "object" ? o instanceof Node :
                                      Severity: Minor
                                      Found in src/utils/dygraph.js - About 3 hrs to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Function RGBColor has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function RGBColor(color_string)
                                      {
                                          this.ok = false;
                                      
                                          // strip any leading #
                                      Severity: Minor
                                      Found in src/utils/dygraph.js - About 3 hrs to fix

                                      Cognitive Complexity

                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                      A method's cognitive complexity is based on a few simple rules:

                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                      • Code is considered more complex for each "break in the linear flow of the code"
                                      • Code is considered more complex when "flow breaking structures are nested"

                                      Further reading

                                      Function getDateAxis has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) {
                                          var formatter = opts("axisLabelFormatter");
                                          var ticks = [];
                                          var t;
                                      
                                      
                                      Severity: Major
                                      Found in src/utils/dygraph.js - About 2 hrs to fix

                                        Function start_ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        Dygraph.prototype.start_ = function() {
                                            var data = this.file_;
                                        
                                            // Functions can return references of all other types.
                                            if (typeof data == 'function') {
                                        Severity: Minor
                                        Found in src/utils/dygraph.js - About 2 hrs to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

                                        Function createDragInterface_ has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        Dygraph.prototype.createDragInterface_ = function() {
                                            var context = {
                                                // Tracks whether the mouse is down right now
                                                isZooming: false,
                                                isPanning: false,  // is this drag part of a pan?
                                        Severity: Major
                                        Found in src/utils/dygraph.js - About 2 hrs to fix

                                          Function binarySearch has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                          Dygraph.binarySearch = function(val, arry, abs, low, high) {
                                              if (low === null || low === undefined ||
                                                  high === null || high === undefined) {
                                                  low = 0;
                                                  high = arry.length - 1;
                                          Severity: Minor
                                          Found in src/utils/dygraph.js - About 2 hrs to fix

                                          Cognitive Complexity

                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                          A method's cognitive complexity is based on a few simple rules:

                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                          • Code is considered more complex for each "break in the linear flow of the code"
                                          • Code is considered more complex when "flow breaking structures are nested"

                                          Further reading

                                          Function doUnzoom_ has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                          Dygraph.prototype.doUnzoom_ = function() {
                                              var dirty = false, dirtyX = false, dirtyY = false;
                                              if (this.dateWindow_ !== null) {
                                                  dirty = true;
                                                  dirtyX = true;
                                          Severity: Major
                                          Found in src/utils/dygraph.js - About 2 hrs to fix

                                            Function updateSelection_ has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                            Dygraph.prototype.updateSelection_ = function(opt_animFraction) {
                                                var defaultPrevented = this.cascadeEvents_('select', {
                                                    selectedX: this.lastx_,
                                                    selectedPoints: this.selPoints_
                                                });
                                            Severity: Major
                                            Found in src/utils/dygraph.js - About 2 hrs to fix

                                              Function moveTouch has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                              Dygraph.Interaction.moveTouch = function(event, g, context) {
                                                  var i, touches = [];
                                                  for (i = 0; i < event.touches.length; i++) {
                                                      var t = event.touches[i];
                                                      touches.push({
                                              Severity: Major
                                              Found in src/utils/dygraph.js - About 2 hrs to fix

                                                Function strftime has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)<r&&r>1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};
                                                Severity: Minor
                                                Found in src/utils/dygraph.js - About 2 hrs to fix

                                                Cognitive Complexity

                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                A method's cognitive complexity is based on a few simple rules:

                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                • Code is considered more complex when "flow breaking structures are nested"

                                                Further reading

                                                Function _createIEClipArea has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                DygraphCanvasRenderer.prototype._createIEClipArea = function() {
                                                    var className = 'dygraph-clip-div';
                                                    var graphDiv = this.dygraph_.graphDiv;
                                                
                                                    // Remove old clip divs.
                                                Severity: Major
                                                Found in src/utils/dygraph.js - About 2 hrs to fix

                                                  Function updateOptions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) {
                                                      if (typeof(block_redraw) == 'undefined') block_redraw = false;
                                                  
                                                      // mapLegacyOptions_ drops the "file" parameter as a convenience to us.
                                                      var file = input_attrs.file;
                                                  Severity: Minor
                                                  Found in src/utils/dygraph.js - About 2 hrs to fix

                                                  Cognitive Complexity

                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                  A method's cognitive complexity is based on a few simple rules:

                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                  Further reading

                                                  Function parseArray_ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                                  Open

                                                  Dygraph.prototype.parseArray_ = function(data) {
                                                      // Peek at the first x value to see if it's numeric.
                                                      if (data.length === 0) {
                                                          this.error("Can't plot empty data set");
                                                          return null;
                                                  Severity: Minor
                                                  Found in src/utils/dygraph.js - About 2 hrs to fix

                                                  Cognitive Complexity

                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                  A method's cognitive complexity is based on a few simple rules:

                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                  Further reading

                                                  Function _drawSeries has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                  DygraphCanvasRenderer.prototype._drawSeries = function(
                                                      ctx, iter, strokeWidth, pointSize, drawPoints, drawGapPoints,
                                                      stepPlot, strategy) {
                                                  
                                                      var prevCanvasX = null;
                                                  Severity: Major
                                                  Found in src/utils/dygraph.js - About 2 hrs to fix

                                                    Function generateLegendHTML has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        var generateLegendHTML = function(g, x, sel_points, oneEmWidth) {
                                                            // TODO(danvk): deprecate this option in place of {legend: 'never'}
                                                            if (g.getOption('showLabelsOnHighlight') !== true) return '';
                                                    
                                                            // If no points are selected, we display a default legend. Traditionally,
                                                    Severity: Minor
                                                    Found in src/utils/dygraph.js - About 1 hr to fix

                                                      Function _renderChartLabels has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      DygraphCanvasRenderer.prototype._renderChartLabels = function() {
                                                          var div, class_div;
                                                      
                                                          // Generate divs for the chart title, xlabel and ylabel.
                                                          // Space for these divs has already been taken away from the charting area in
                                                      Severity: Minor
                                                      Found in src/utils/dygraph.js - About 1 hr to fix

                                                      Cognitive Complexity

                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                      A method's cognitive complexity is based on a few simple rules:

                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                      Further reading

                                                      Function clear has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      DygraphCanvasRenderer.prototype.clear = function() {
                                                          var context;
                                                          if (this.isIE) {
                                                              // VML takes a while to start up, so we just poll every this.IEDelay
                                                              try {
                                                      Severity: Minor
                                                      Found in src/utils/dygraph.js - About 1 hr to fix

                                                      Cognitive Complexity

                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                      A method's cognitive complexity is based on a few simple rules:

                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                      Further reading

                                                      Function setColors_ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      Dygraph.prototype.setColors_ = function() {
                                                          var num = this.attr_("labels").length - 1;
                                                          this.colors_ = [];
                                                          var colors = this.attr_('colors');
                                                          var i;
                                                      Severity: Minor
                                                      Found in src/utils/dygraph.js - About 1 hr to fix

                                                      Cognitive Complexity

                                                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                      A method's cognitive complexity is based on a few simple rules:

                                                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                      • Code is considered more complex for each "break in the linear flow of the code"
                                                      • Code is considered more complex when "flow breaking structures are nested"

                                                      Further reading

                                                      Function createRotatedDiv has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          function createRotatedDiv(axis, classes, html) {
                                                              var box = {
                                                                  left: 0,
                                                                  top: that.area.y,
                                                                  width: that.attr_('yLabelWidth'),
                                                      Severity: Minor
                                                      Found in src/utils/dygraph.js - About 1 hr to fix

                                                        Function startPan has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                        Dygraph.Interaction.startPan = function(event, g, context) {
                                                            var i, axis;
                                                            context.isPanning = true;
                                                            var xRange = g.xAxisRange();
                                                            context.dateRange = xRange[1] - xRange[0];
                                                        Severity: Minor
                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                          Function render has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                          DygraphCanvasRenderer.prototype.render = function() {
                                                              // Draw the new X/Y grid. Lines appear crisper when pixels are rounded to
                                                              // half-integers. This prevents them from drawing in two rows/cols.
                                                              var ctx = this.elementContext;
                                                              function halfUp(x)  { return Math.round(x) + 0.5; }
                                                          Severity: Minor
                                                          Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                var generateLegendDashHTML = function(strokePattern, color, oneEmWidth) {
                                                                    // IE 7,8 fail at these divs, so they get boring legend, have not tested 9.
                                                                    var isIE = (/MSIE/.test(navigator.userAgent) && !window.opera);
                                                                    if (isIE) return "&mdash;";
                                                            
                                                            
                                                            Severity: Minor
                                                            Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                  legend.prototype.activate = function(g) {
                                                                      var div;
                                                                      var divWidth = g.getOption('labelsDivWidth');
                                                              
                                                                      var userLabelsDiv = g.getOption('labelsDiv');
                                                              Severity: Minor
                                                              Found in src/utils/dygraph.js - About 1 hr to fix

                                                                Function movePan has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                Dygraph.Interaction.movePan = function(event, g, context) {
                                                                    context.dragEndX = g.dragGetX_(event, context);
                                                                    context.dragEndY = g.dragGetY_(event, context);
                                                                
                                                                    var minDate = context.initialLeftmostDate -
                                                                Severity: Minor
                                                                Found in src/utils/dygraph.js - About 1 hr to fix

                                                                  Function parseArray_ has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                  Open

                                                                  Dygraph.prototype.parseArray_ = function(data) {
                                                                      // Peek at the first x value to see if it's numeric.
                                                                      if (data.length === 0) {
                                                                          this.error("Can't plot empty data set");
                                                                          return null;
                                                                  Severity: Minor
                                                                  Found in src/utils/dygraph.js - About 1 hr to fix

                                                                    Function findStackedPoint has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                    Dygraph.prototype.findStackedPoint = function(domX, domY) {
                                                                        var row = this.findClosestRow(domX);
                                                                        var boundary = this.getLeftBoundary_();
                                                                        var rowIdx = row - boundary;
                                                                        var points = this.layout_.points;
                                                                    Severity: Minor
                                                                    Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                      DygraphCanvasRenderer.prototype._dashedLine = function(ctx, x, y, x2, y2, pattern) {
                                                                          // Original version http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas
                                                                          // Modified by Russell Valentine to keep line history and continue the pattern
                                                                          // where it left off.
                                                                          var dx, dy, len, rot, patternIndex, segment;
                                                                      Severity: Minor
                                                                      Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                        Dygraph.prototype.createDragInterface_ = function() {
                                                                            var context = {
                                                                                // Tracks whether the mouse is down right now
                                                                                isZooming: false,
                                                                                isPanning: false,  // is this drag part of a pan?
                                                                        Severity: Minor
                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                        Cognitive Complexity

                                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                        A method's cognitive complexity is based on a few simple rules:

                                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                                        Further reading

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

                                                                        Dygraph.Interaction.moveTouch = function(event, g, context) {
                                                                            var i, touches = [];
                                                                            for (i = 0; i < event.touches.length; i++) {
                                                                                var t = event.touches[i];
                                                                                touches.push({
                                                                        Severity: Minor
                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                        Cognitive Complexity

                                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                        A method's cognitive complexity is based on a few simple rules:

                                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                                        Further reading

                                                                        Function drawMiniPlot_ has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                        Open

                                                                        DygraphRangeSelector.prototype.drawMiniPlot_ = function() {
                                                                            var fillStyle = this.attr_('rangeSelectorPlotFillColor');
                                                                            var strokeStyle = this.attr_('rangeSelectorPlotStrokeColor');
                                                                            if (!fillStyle && !strokeStyle) {
                                                                                return;
                                                                        Severity: Minor
                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                          Dygraph.prototype.createInterface_ = function() {
                                                                              // Create the all-enclosing graph div
                                                                              var enclosing = this.maindiv_;
                                                                          
                                                                              this.graphDiv = document.createElement("div");
                                                                          Severity: Minor
                                                                          Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                            Dygraph.binarySearch = function(val, arry, abs, low, high) {
                                                                                if (low === null || low === undefined ||
                                                                                    high === null || high === undefined) {
                                                                                    low = 0;
                                                                                    high = arry.length - 1;
                                                                            Severity: Minor
                                                                            Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                              DygraphRangeSelector.prototype.drawInteractiveLayer_ = function() {
                                                                                  var ctx = this.fgcanvas_ctx_;
                                                                                  ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h);
                                                                                  var margin = 1;
                                                                                  var width = this.canvasRect_.w - margin;
                                                                              Severity: Minor
                                                                              Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                Function computePlotArea_ has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                Open

                                                                                DygraphLayout.prototype.computePlotArea_ = function() {
                                                                                    var area = {
                                                                                        // TODO(danvk): per-axis setting.
                                                                                        x: 0,
                                                                                        y: 0
                                                                                Severity: Minor
                                                                                Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                  Function setSelection has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                  Open

                                                                                  Dygraph.prototype.setSelection = function(row, opt_seriesName) {
                                                                                      // Extract the points we've selected
                                                                                      this.selPoints_ = [];
                                                                                      var pos = 0;
                                                                                  
                                                                                  
                                                                                  Severity: Minor
                                                                                  Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                    Dygraph.Interaction.startTouch = function(event, g, context) {
                                                                                        event.preventDefault();  // touch browsers are all nice.
                                                                                        var touches = [];
                                                                                        for (var i = 0; i < event.touches.length; i++) {
                                                                                            var t = event.touches[i];
                                                                                    Severity: Minor
                                                                                    Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                      Dygraph.prototype.drawGraph_ = function() {
                                                                                          var start = new Date();
                                                                                      
                                                                                          // This is used to set the second parameter to drawCallback, below.
                                                                                          var is_initial_draw = this.is_initial_draw_;
                                                                                      Severity: Minor
                                                                                      Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                        Function dateParser has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                        Dygraph.dateParser = function(dateStr) {
                                                                                            var dateStrSlashed;
                                                                                            var d;
                                                                                        
                                                                                            // Let the system try the format first, with one caveat:
                                                                                        Severity: Minor
                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                        Cognitive Complexity

                                                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                        A method's cognitive complexity is based on a few simple rules:

                                                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                                                        Further reading

                                                                                        Function computePlotArea_ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                        DygraphLayout.prototype.computePlotArea_ = function() {
                                                                                            var area = {
                                                                                                // TODO(danvk): per-axis setting.
                                                                                                x: 0,
                                                                                                y: 0
                                                                                        Severity: Minor
                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                        Cognitive Complexity

                                                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                        A method's cognitive complexity is based on a few simple rules:

                                                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                                                        Further reading

                                                                                        Function addAnnotationRule has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                        Dygraph.addAnnotationRule = function() {
                                                                                            if (Dygraph.addedAnnotationCSS) return;
                                                                                        
                                                                                            var rule = "border: 1px solid black; " +
                                                                                                "background-color: white; " +
                                                                                        Severity: Minor
                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                        Cognitive Complexity

                                                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                        A method's cognitive complexity is based on a few simple rules:

                                                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                                                        Further reading

                                                                                        Function numDateTicks has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                        Dygraph.numDateTicks = function(start_time, end_time, granularity) {
                                                                                            if (granularity < Dygraph.MONTHLY) {
                                                                                                // Generate one tick mark for every fixed interval of time.
                                                                                                var spacing = Dygraph.SHORT_SPACINGS[granularity];
                                                                                                return Math.floor(0.5 + 1.0 * (end_time - start_time) / spacing);
                                                                                        Severity: Minor
                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                        Cognitive Complexity

                                                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                        A method's cognitive complexity is based on a few simple rules:

                                                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                                                        Further reading

                                                                                        Function _dashedLine has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                        DygraphCanvasRenderer.prototype._dashedLine = function(ctx, x, y, x2, y2, pattern) {
                                                                                            // Original version http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas
                                                                                            // Modified by Russell Valentine to keep line history and continue the pattern
                                                                                            // where it left off.
                                                                                            var dx, dy, len, rot, patternIndex, segment;
                                                                                        Severity: Minor
                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                        Cognitive Complexity

                                                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                        A method's cognitive complexity is based on a few simple rules:

                                                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                                                        Further reading

                                                                                        Function attr_ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                        Dygraph.prototype.attr_ = function(name, seriesName) {
                                                                                        
                                                                                            var sources = [];
                                                                                            sources.push(this.attrs_);
                                                                                            if (this.user_attrs_) {
                                                                                        Severity: Minor
                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                        Cognitive Complexity

                                                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                        A method's cognitive complexity is based on a few simple rules:

                                                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                                                        Further reading

                                                                                        Function doAnimatedZoom has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                        Open

                                                                                        Dygraph.prototype.doAnimatedZoom = function(oldXRange, newXRange, oldYRanges, newYRanges, callback) {
                                                                                            var steps = this.attr_("animatedZooms") ? Dygraph.ANIMATION_STEPS : 1;
                                                                                        
                                                                                            var windows = [];
                                                                                            var valueRanges = [];
                                                                                        Severity: Minor
                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                          Function _evaluateLineCharts has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                          Open

                                                                                          DygraphLayout.prototype._evaluateLineCharts = function() {
                                                                                              // An array to keep track of how many points will be drawn for each set.
                                                                                              // This will allow for the canvas renderer to not have to check every point
                                                                                              // for every data set since the points are added in order of the sets in
                                                                                              // datasets.
                                                                                          Severity: Minor
                                                                                          Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                            Function log has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                            Open

                                                                                            Dygraph.log = function(severity, message) {
                                                                                                var st;
                                                                                                if (typeof(printStackTrace) != 'undefined') {
                                                                                                    // Remove uninteresting bits: logging functions and paths.
                                                                                                    st = printStackTrace({guess:false});
                                                                                            Severity: Minor
                                                                                            Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                              Function clear has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                              Open

                                                                                              DygraphCanvasRenderer.prototype.clear = function() {
                                                                                                  var context;
                                                                                                  if (this.isIE) {
                                                                                                      // VML takes a while to start up, so we just poll every this.IEDelay
                                                                                                      try {
                                                                                              Severity: Minor
                                                                                              Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                Function _evaluateLimits has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                Open

                                                                                                DygraphLayout.prototype._evaluateLimits = function () {
                                                                                                    //TODO(tomaton): fix xrange when last x value is not the highest in case of x = sin(y) x is from 0 to 1 and back to 0
                                                                                                    //and range for x is 0 to 1
                                                                                                    this.minxval = this.maxxval = null;
                                                                                                    if (this.dateWindow_) {
                                                                                                Severity: Minor
                                                                                                Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                                  Dygraph.Interaction.treatMouseOpAsClick = function(g, event, context) {
                                                                                                      var clickCallback = g.attr_('clickCallback');
                                                                                                      var pointClickCallback = g.attr_('pointClickCallback');
                                                                                                  
                                                                                                      var selectedPoint = null;
                                                                                                  Severity: Minor
                                                                                                  Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                  Cognitive Complexity

                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                  Further reading

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

                                                                                                  Dygraph.mapLegacyOptions_ = function(attrs) {
                                                                                                      var my_attrs = {};
                                                                                                      for (var k in attrs) {
                                                                                                          if (k == 'file') continue;
                                                                                                          if (attrs.hasOwnProperty(k)) my_attrs[k] = attrs[k];
                                                                                                  Severity: Minor
                                                                                                  Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                  Cognitive Complexity

                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                  Further reading

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

                                                                                                  Dygraph.prototype.mouseMove_ = function(event) {
                                                                                                      // This prevents JS errors when mousing over the canvas before data loads.
                                                                                                      var points = this.layout_.points;
                                                                                                      if (points === undefined) return;
                                                                                                  
                                                                                                  
                                                                                                  Severity: Minor
                                                                                                  Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                  Cognitive Complexity

                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                  Further reading

                                                                                                  Function start_ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                  Dygraph.prototype.start_ = function() {
                                                                                                      var data = this.file_;
                                                                                                  
                                                                                                      // Functions can return references of all other types.
                                                                                                      if (typeof data == 'function') {
                                                                                                  Severity: Minor
                                                                                                  Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                    Function mouseMove_ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                    Dygraph.prototype.mouseMove_ = function(event) {
                                                                                                        // This prevents JS errors when mousing over the canvas before data loads.
                                                                                                        var points = this.layout_.points;
                                                                                                        if (points === undefined) return;
                                                                                                    
                                                                                                    
                                                                                                    Severity: Minor
                                                                                                    Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                      Function resize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                      Dygraph.prototype.resize = function(width, height) {
                                                                                                          if (this.resize_lock) {
                                                                                                              return;
                                                                                                          }
                                                                                                          this.resize_lock = true;
                                                                                                      Severity: Minor
                                                                                                      Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                        Function extremeValues_ has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                        Dygraph.prototype.extremeValues_ = function(series) {
                                                                                                            var minY = null, maxY = null, j, y;
                                                                                                        
                                                                                                            var bars = this.attr_("errorBars") || this.attr_("customBars");
                                                                                                            if (bars) {
                                                                                                        Severity: Minor
                                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                          Function DygraphCanvasRenderer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                          Open

                                                                                                          var DygraphCanvasRenderer = function(dygraph, element, elementContext, layout) {
                                                                                                              this.dygraph_ = dygraph;
                                                                                                          
                                                                                                              this.layout = layout;
                                                                                                              this.element = element;
                                                                                                          Severity: Minor
                                                                                                          Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                                            Dygraph.prototype.updateOptions = function(input_attrs, block_redraw) {
                                                                                                                if (typeof(block_redraw) == 'undefined') block_redraw = false;
                                                                                                            
                                                                                                                // mapLegacyOptions_ drops the "file" parameter as a convenience to us.
                                                                                                                var file = input_attrs.file;
                                                                                                            Severity: Minor
                                                                                                            Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                              Function _drawStyledLine has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                              Open

                                                                                                                  ctx, i, setName, color, strokeWidth, strokePattern, drawPoints,
                                                                                                                  drawPointCallback, pointSize) {
                                                                                                              Severity: Major
                                                                                                              Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                                                DygraphCanvasRenderer.prototype._createIEClipArea = function() {
                                                                                                                    var className = 'dygraph-clip-div';
                                                                                                                    var graphDiv = this.dygraph_.graphDiv;
                                                                                                                
                                                                                                                    // Remove old clip divs.
                                                                                                                Severity: Minor
                                                                                                                Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                                Cognitive Complexity

                                                                                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                A method's cognitive complexity is based on a few simple rules:

                                                                                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                Further reading

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

                                                                                                                Dygraph.prototype.doAnimatedZoom = function(oldXRange, newXRange, oldYRanges, newYRanges, callback) {
                                                                                                                    var steps = this.attr_("animatedZooms") ? Dygraph.ANIMATION_STEPS : 1;
                                                                                                                
                                                                                                                    var windows = [];
                                                                                                                    var valueRanges = [];
                                                                                                                Severity: Minor
                                                                                                                Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                                Cognitive Complexity

                                                                                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                A method's cognitive complexity is based on a few simple rules:

                                                                                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                Further reading

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

                                                                                                                Dygraph.prototype.drawZoomRect_ = function(direction, startX, endX, startY,
                                                                                                                                                           endY, prevDirection, prevEndX,
                                                                                                                                                           prevEndY) {
                                                                                                                    var ctx = this.canvas_ctx_;
                                                                                                                
                                                                                                                
                                                                                                                Severity: Minor
                                                                                                                Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                                Cognitive Complexity

                                                                                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                A method's cognitive complexity is based on a few simple rules:

                                                                                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                Further reading

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

                                                                                                                DygraphCanvasRenderer.prototype.render = function() {
                                                                                                                    // Draw the new X/Y grid. Lines appear crisper when pixels are rounded to
                                                                                                                    // half-integers. This prevents them from drawing in two rows/cols.
                                                                                                                    var ctx = this.elementContext;
                                                                                                                    function halfUp(x)  { return Math.round(x) + 0.5; }
                                                                                                                Severity: Minor
                                                                                                                Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                                Cognitive Complexity

                                                                                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                A method's cognitive complexity is based on a few simple rules:

                                                                                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                Further reading

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

                                                                                                                Dygraph.prototype.destroy = function() {
                                                                                                                    var removeRecursive = function(node) {
                                                                                                                        while (node.hasChildNodes()) {
                                                                                                                            removeRecursive(node.firstChild);
                                                                                                                            node.removeChild(node.firstChild);
                                                                                                                Severity: Minor
                                                                                                                Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                                                  Dygraph.hsvToRGB = function (hue, saturation, value) {
                                                                                                                      var red;
                                                                                                                      var green;
                                                                                                                      var blue;
                                                                                                                      if (saturation === 0) {
                                                                                                                  Severity: Minor
                                                                                                                  Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                                                    Dygraph.Interaction.treatMouseOpAsClick = function(g, event, context) {
                                                                                                                        var clickCallback = g.attr_('clickCallback');
                                                                                                                        var pointClickCallback = g.attr_('pointClickCallback');
                                                                                                                    
                                                                                                                        var selectedPoint = null;
                                                                                                                    Severity: Minor
                                                                                                                    Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                                                      Dygraph.updateDeep = function (self, o) {
                                                                                                                          // Taken from http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
                                                                                                                          function isNode(o) {
                                                                                                                              return (
                                                                                                                                  typeof Node === "object" ? o instanceof Node :
                                                                                                                      Severity: Minor
                                                                                                                      Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                                                        Dygraph.prototype.findClosestPoint = function(domX, domY) {
                                                                                                                            var minDist = Infinity;
                                                                                                                            var idx = -1;
                                                                                                                            var points = this.layout_.points;
                                                                                                                            var dist, dx, dy, point, closestPoint, closestSeries;
                                                                                                                        Severity: Minor
                                                                                                                        Found in src/utils/dygraph.js - About 1 hr to fix

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

                                                                                                                          DygraphRangeSelector.prototype.createZoomHandles_ = function() {
                                                                                                                              var img = new Image();
                                                                                                                              img.className = 'dygraph-rangesel-zoomhandle';
                                                                                                                              img.style.position = 'absolute';
                                                                                                                              img.style.zIndex = 10;
                                                                                                                          Severity: Minor
                                                                                                                          Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                                            Function DrawPolygon_ has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                            Open

                                                                                                                            Dygraph.DrawPolygon_ = function(sides, rotationRadians, ctx, cx, cy, color, radius, delta) {
                                                                                                                            Severity: Major
                                                                                                                            Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                                              Function _drawSeries has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                              Open

                                                                                                                                  ctx, iter, strokeWidth, pointSize, drawPoints, drawGapPoints,
                                                                                                                                  stepPlot, strategy) {
                                                                                                                              Severity: Major
                                                                                                                              Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                                                Function drawZoomRect_ has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                Open

                                                                                                                                Dygraph.prototype.drawZoomRect_ = function(direction, startX, endX, startY,
                                                                                                                                                                           endY, prevDirection, prevEndX,
                                                                                                                                                                           prevEndY) {
                                                                                                                                Severity: Major
                                                                                                                                Found in src/utils/dygraph.js - About 1 hr to fix

                                                                                                                                  Function setAnnotations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                  DygraphLayout.prototype.setAnnotations = function(ann) {
                                                                                                                                      // The Dygraph object's annotations aren't parsed. We parse them here and
                                                                                                                                      // save a copy. If there is no parser, then the user must be using raw format.
                                                                                                                                      this.annotations = [];
                                                                                                                                      var parse = this.attr_('xValueParser') || function(x) { return x; };
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in src/utils/dygraph.js - About 55 mins to fix

                                                                                                                                  Cognitive Complexity

                                                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                  Further reading

                                                                                                                                  Function _evaluateLineTicks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                  DygraphLayout.prototype._evaluateLineTicks = function() {
                                                                                                                                      var i, tick, label, pos;
                                                                                                                                      this.xticks = [];
                                                                                                                                      for (i = 0; i < this.xTicks_.length; i++) {
                                                                                                                                          tick = this.xTicks_[i];
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in src/utils/dygraph.js - About 55 mins to fix

                                                                                                                                  Cognitive Complexity

                                                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                  Further reading

                                                                                                                                  Function log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                  Dygraph.log = function(severity, message) {
                                                                                                                                      var st;
                                                                                                                                      if (typeof(printStackTrace) != 'undefined') {
                                                                                                                                          // Remove uninteresting bits: logging functions and paths.
                                                                                                                                          st = printStackTrace({guess:false});
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in src/utils/dygraph.js - About 55 mins to fix

                                                                                                                                  Cognitive Complexity

                                                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                  Further reading

                                                                                                                                  Function findPosX has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                  Dygraph.findPosX = function(obj) {
                                                                                                                                      var curleft = 0;
                                                                                                                                      if(obj.offsetParent) {
                                                                                                                                          var copyObj = obj;
                                                                                                                                          while(1) {
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in src/utils/dygraph.js - About 55 mins to fix

                                                                                                                                  Cognitive Complexity

                                                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                  Further reading

                                                                                                                                  Function startPan has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                  Dygraph.Interaction.startPan = function(event, g, context) {
                                                                                                                                      var i, axis;
                                                                                                                                      context.isPanning = true;
                                                                                                                                      var xRange = g.xAxisRange();
                                                                                                                                      context.dateRange = xRange[1] - xRange[0];
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in src/utils/dygraph.js - About 55 mins to fix

                                                                                                                                  Cognitive Complexity

                                                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                  Further reading

                                                                                                                                  Function cascadeEvents_ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                  Dygraph.prototype.cascadeEvents_ = function(name, extra_props) {
                                                                                                                                      if (!name in this.eventListeners_) return true;
                                                                                                                                  
                                                                                                                                      // QUESTION: can we use objects & prototypes to speed this up?
                                                                                                                                      var e = {
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in src/utils/dygraph.js - About 55 mins to fix

                                                                                                                                  Cognitive Complexity

                                                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                  Further reading

                                                                                                                                  Function findClosestPoint has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                  Dygraph.prototype.findClosestPoint = function(domX, domY) {
                                                                                                                                      var minDist = Infinity;
                                                                                                                                      var idx = -1;
                                                                                                                                      var points = this.layout_.points;
                                                                                                                                      var dist, dx, dy, point, closestPoint, closestSeries;
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in src/utils/dygraph.js - About 55 mins to fix

                                                                                                                                  Cognitive Complexity

                                                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                  Further reading

                                                                                                                                  Function evaluateWithError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                  DygraphLayout.prototype.evaluateWithError = function() {
                                                                                                                                      this.evaluate();
                                                                                                                                      if (!(this.attr_('errorBars') || this.attr_('customBars'))) return;
                                                                                                                                  
                                                                                                                                      // Copy over the error terms
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in src/utils/dygraph.js - About 55 mins to fix

                                                                                                                                  Cognitive Complexity

                                                                                                                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                  A method's cognitive complexity is based on a few simple rules:

                                                                                                                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                  • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                  • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                  Further reading

                                                                                                                                  Function EX has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                  Open

                                                                                                                                      EX : function(g, name, ctx, cx, cy, color, radius) {
                                                                                                                                  Severity: Major
                                                                                                                                  Found in src/utils/dygraph.js - About 50 mins to fix

                                                                                                                                    Function CIRCLE has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                    Open

                                                                                                                                        CIRCLE : function(g, name, ctx, cx, cy, color, radius) {
                                                                                                                                    Severity: Major
                                                                                                                                    Found in src/utils/dygraph.js - About 50 mins to fix

                                                                                                                                      Function DEFAULT has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                      Open

                                                                                                                                          DEFAULT : function(g, name, ctx, canvasx, canvasy, color, radius) {
                                                                                                                                      Severity: Major
                                                                                                                                      Found in src/utils/dygraph.js - About 50 mins to fix

                                                                                                                                        Function regularShape_ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                        Open

                                                                                                                                            ctx, sides, radius, cx, cy, rotationRadians, delta) {
                                                                                                                                        Severity: Major
                                                                                                                                        Found in src/utils/dygraph.js - About 50 mins to fix

                                                                                                                                          Function PLUS has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                          Open

                                                                                                                                              PLUS : function(g, name, ctx, cx, cy, color, radius) {
                                                                                                                                          Severity: Major
                                                                                                                                          Found in src/utils/dygraph.js - About 50 mins to fix

                                                                                                                                            Function findPosY has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                            Open

                                                                                                                                            Dygraph.findPosY = function(obj) {
                                                                                                                                                var curtop = 0;
                                                                                                                                                if(obj.offsetParent) {
                                                                                                                                                    var copyObj = obj;
                                                                                                                                                    while(1) {
                                                                                                                                            Severity: Minor
                                                                                                                                            Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                            Cognitive Complexity

                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                            Further reading

                                                                                                                                            Function numericLinearTicks has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                            Open

                                                                                                                                            Dygraph.numericLinearTicks = function (a, b, pixels, opts, dygraph, vals) {
                                                                                                                                            Severity: Minor
                                                                                                                                            Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                              Function _evaluateLineCharts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                              Open

                                                                                                                                              DygraphLayout.prototype._evaluateLineCharts = function() {
                                                                                                                                                  // An array to keep track of how many points will be drawn for each set.
                                                                                                                                                  // This will allow for the canvas renderer to not have to check every point
                                                                                                                                                  // for every data set since the points are added in order of the sets in
                                                                                                                                                  // datasets.
                                                                                                                                              Severity: Minor
                                                                                                                                              Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                              Cognitive Complexity

                                                                                                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                              A method's cognitive complexity is based on a few simple rules:

                                                                                                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                              Further reading

                                                                                                                                              Function _dashedLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                              Open

                                                                                                                                              DygraphCanvasRenderer.prototype._dashedLine = function(ctx, x, y, x2, y2, pattern) {
                                                                                                                                              Severity: Minor
                                                                                                                                              Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                Function resize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                Open

                                                                                                                                                Dygraph.prototype.resize = function(width, height) {
                                                                                                                                                    if (this.resize_lock) {
                                                                                                                                                        return;
                                                                                                                                                    }
                                                                                                                                                    this.resize_lock = true;
                                                                                                                                                Severity: Minor
                                                                                                                                                Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                Cognitive Complexity

                                                                                                                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                Further reading

                                                                                                                                                Function destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                Open

                                                                                                                                                Dygraph.prototype.destroy = function() {
                                                                                                                                                    var removeRecursive = function(node) {
                                                                                                                                                        while (node.hasChildNodes()) {
                                                                                                                                                            removeRecursive(node.firstChild);
                                                                                                                                                            node.removeChild(node.firstChild);
                                                                                                                                                Severity: Minor
                                                                                                                                                Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                Cognitive Complexity

                                                                                                                                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                Further reading

                                                                                                                                                Function dateTicker has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                Open

                                                                                                                                                Dygraph.dateTicker = function (a, b, pixels, opts, dygraph, vals) {
                                                                                                                                                Severity: Minor
                                                                                                                                                Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                  Function _drawPointsOnLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                  Open

                                                                                                                                                  DygraphCanvasRenderer.prototype._drawPointsOnLine = function(ctx, pointsOnLine, drawPointCallback, setName, color, pointSize) {
                                                                                                                                                  Severity: Minor
                                                                                                                                                  Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                    Function numericTicks has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                    Open

                                                                                                                                                    Dygraph.numericTicks = function (a, b, pixels, opts, dygraph, vals) {
                                                                                                                                                    Severity: Minor
                                                                                                                                                    Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                                      Open

                                                                                                                                                                          if (typeof(self[k]) != 'object' || self[k] === null) {
                                                                                                                                                                              self[k] = {};
                                                                                                                                                                          }
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                                                        Open

                                                                                                                                                                        if (num_ok) {
                                                                                                                                                                            rollingData[i] = [originalData[i][0], sum / num_ok];
                                                                                                                                                                        } else {
                                                                                                                                                                            rollingData[i] = [originalData[i][0], null];
                                                                                                                                                                        }
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                                                          Open

                                                                                                                                                                      for (j = 1; j < inFields.length; j++) {
                                                                                                                                                                          var val = inFields[j];
                                                                                                                                                                          if (/^ *$/.test(val)) {
                                                                                                                                                                              fields[j] = [null, null, null];
                                                                                                                                                                          } else {
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                                                            Open

                                                                                                                                                                        for (j = 1; j < inFields.length; j++) {
                                                                                                                                                                            fields[j] = this.parseFloat_(inFields[j], i, line);
                                                                                                                                                                        }
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                                                              Open

                                                                                                                                                                                  if (!isNaN(prevX)) {
                                                                                                                                                                                      if (stepPlot) {
                                                                                                                                                                                          ctx.moveTo(prevX, newYs[0]);
                                                                                                                                                                                      } else {
                                                                                                                                                                                          ctx.moveTo(prevX, prevYs[0]);
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                                                Open

                                                                                                                                                                                if (point.name == setName) { // TODO(klausw): this is always true
                                                                                                                                                                                    if (!Dygraph.isOK(point.y)) {
                                                                                                                                                                                        prevX = NaN;
                                                                                                                                                                                        continue;
                                                                                                                                                                                    }
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                                                  Open

                                                                                                                                                                                      for (i = datasets.length - 1; i >= 0; i--) {
                                                                                                                                                                                          if (!datasets[i]) continue;
                                                                                                                                                                                          datasets[i][j][1] = NaN;
                                                                                                                                                                                      }
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                                                                    Open

                                                                                                                                                                                    if (cumulative_y[x] > seriesExtremes[1]) {
                                                                                                                                                                                        seriesExtremes[1] = cumulative_y[x];
                                                                                                                                                                                    }
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                                                      Open

                                                                                                                                                                                      if (cumulative_y[x] < seriesExtremes[0]) {
                                                                                                                                                                                          seriesExtremes[0] = cumulative_y[x];
                                                                                                                                                                                      }
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                                                                        Open

                                                                                                                                                                                        if (cumulative_y[x] === undefined) {
                                                                                                                                                                                            cumulative_y[x] = 0;
                                                                                                                                                                                        }
                                                                                                                                                                        Severity: Major
                                                                                                                                                                        Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                                                                          Open

                                                                                                                                                                                              if (maxY < 0) maxAxisY = 0;
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                                                                            Open

                                                                                                                                                                                            if (num_ok) {
                                                                                                                                                                                                stddev = Math.sqrt(variance) / num_ok;
                                                                                                                                                                                                rollingData[i] = [originalData[i][0],
                                                                                                                                                                                                    [sum / num_ok, sigma * stddev, sigma * stddev]];
                                                                                                                                                                                            } else {
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                                                                              Open

                                                                                                                                                                                                  if (attrs[property].hasOwnProperty(subProperty) && !pixelSafeOptions[subProperty]) {
                                                                                                                                                                                                      requiresNewPoints = true;
                                                                                                                                                                                                  }
                                                                                                                                                                              Severity: Major
                                                                                                                                                                              Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                                                                Open

                                                                                                                                                                                                    if (lastDisplayed === null) {
                                                                                                                                                                                                        lastDisplayed = {
                                                                                                                                                                                                            tickValue: tickValue,
                                                                                                                                                                                                            pixel_coord: pixel_coord
                                                                                                                                                                                                        };
                                                                                                                                                                                Severity: Major
                                                                                                                                                                                Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  if (dx > 0) {
                                                                                                                                                                                                      var r = (p1.canvasx - domX) / dx;
                                                                                                                                                                                                      py += r * (p0.canvasy - p1.canvasy);
                                                                                                                                                                                                  }
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                                                                                    Open

                                                                                                                                                                                                        if (requiresNewPoints) {
                                                                                                                                                                                                            break;
                                                                                                                                                                                                        }
                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                    Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                                                                      Open

                                                                                                                                                                                                          if (g == 7) {  // one week
                                                                                                                                                                                                              d.setDate(d.getDate() - d.getDay());
                                                                                                                                                                                                          }
                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                      Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                                                                                        Open

                                                                                                                                                                                                            if (stepPlot) {
                                                                                                                                                                                                                strategy.drawLine(prevCanvasX, prevCanvasY, point.canvasx, prevCanvasY);
                                                                                                                                                                                                                prevCanvasX = point.canvasx;
                                                                                                                                                                                                            }
                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                        Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                                                                                          Open

                                                                                                                                                                                                              if (stepPlot) {
                                                                                                                                                                                                                  newYs = [ point.y_bottom, point.y_top ];
                                                                                                                                                                                                                  prevY = point.y;
                                                                                                                                                                                                              } else {
                                                                                                                                                                                                                  newYs = [ point.y_bottom, point.y_top ];
                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                          Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                                                                                            Open

                                                                                                                                                                                                                if (minY > 0) minAxisY = 0;
                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                            Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                                                                                              Open

                                                                                                                                                                                                                  for (var k = 0; k < annotationCols[col].length; k++) {
                                                                                                                                                                                                                      if (k) ann.text += "\n";
                                                                                                                                                                                                                      ann.text += data.getValue(i, annotationCols[col][k]);
                                                                                                                                                                                                                  }
                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                              Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                                                                                Open

                                                                                                                                                                                                                    if (!Dygraph.isOK(point.y)) {
                                                                                                                                                                                                                        prevX = NaN;
                                                                                                                                                                                                                        continue;
                                                                                                                                                                                                                    }
                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                                                                                  Open

                                                                                                                                                                                                                  for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) {
                                                                                                                                                                                                                      y = originalData[j][1];
                                                                                                                                                                                                                      if (y === null || isNaN(y)) continue;
                                                                                                                                                                                                                      num_ok++;
                                                                                                                                                                                                                      sum += originalData[j][1];
                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                  Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                                                                                                    Open

                                                                                                                                                                                                                    if (prev[1][1] !== null && !isNaN(prev[1][1])) {
                                                                                                                                                                                                                        low -= prev[1][0];
                                                                                                                                                                                                                        mid -= prev[1][1];
                                                                                                                                                                                                                        high -= prev[1][2];
                                                                                                                                                                                                                        count -= 1;
                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                    Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                                                                                      Open

                                                                                                                                                                                                                      if (actual_y === null) {
                                                                                                                                                                                                                          series[j] = [x, null];
                                                                                                                                                                                                                          continue;
                                                                                                                                                                                                                      }
                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                      Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                                                                                                        Open

                                                                                                                                                                                                                            for (k = 0; k < sum.length; k++) {
                                                                                                                                                                                                                                y = dataPoint[j][k];
                                                                                                                                                                                                                                if (y === null || isNaN(y)) continue;
                                                                                                                                                                                                                                sum[k] += y;
                                                                                                                                                                                                                                count[k]++;
                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                        Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                                                                                                          Open

                                                                                                                                                                                                                              if (y === null || isNaN(y)) continue;
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                                                                                                            Open

                                                                                                                                                                                                                                if (spacing > pixels_per_tick) break;
                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                  if (den) {
                                                                                                                                                                                                                                      var p = value < 0 ? 0 : value, n = den;
                                                                                                                                                                                                                                      var pm = sigma * Math.sqrt(p*(1-p)/n + sigma*sigma/(4*n*n));
                                                                                                                                                                                                                                      var denom = 1 + sigma * sigma / den;
                                                                                                                                                                                                                                      low  = (p + sigma * sigma / (2 * den) - pm) / denom;
                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                              Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) {
                                                                                                                                                                                                                                    y = originalData[j][1][0];
                                                                                                                                                                                                                                    if (y === null || isNaN(y)) continue;
                                                                                                                                                                                                                                    num_ok++;
                                                                                                                                                                                                                                    sum += originalData[j][1][0];
                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                Found in src/utils/dygraph.js - About 45 mins to fix

                                                                                                                                                                                                                  Consider simplifying this complex logical expression.
                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                      if (
                                                                                                                                                                                                                          (typ != 'object' && !(typ == 'function' &&
                                                                                                                                                                                                                              typeof(o.item) == 'function')) ||
                                                                                                                                                                                                                          o === null ||
                                                                                                                                                                                                                          typeof(o.length) != 'number' ||
                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                  Found in src/utils/dygraph.js - About 40 mins to fix

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

                                                                                                                                                                                                                    Dygraph.getDateAxis = function(start_time, end_time, granularity, opts, dg) {
                                                                                                                                                                                                                    Severity: Minor
                                                                                                                                                                                                                    Found in src/utils/dygraph.js - About 35 mins to fix

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

                                                                                                                                                                                                                      Dygraph.binarySearch = function(val, arry, abs, low, high) {
                                                                                                                                                                                                                      Severity: Minor
                                                                                                                                                                                                                      Found in src/utils/dygraph.js - About 35 mins to fix

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

                                                                                                                                                                                                                        var nonTrivialStrategy = function(renderer, ctx, color, strokeWidth, strokePattern) {
                                                                                                                                                                                                                        Severity: Minor
                                                                                                                                                                                                                        Found in src/utils/dygraph.js - About 35 mins to fix

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

                                                                                                                                                                                                                          Dygraph.prototype.doAnimatedZoom = function(oldXRange, newXRange, oldYRanges, newYRanges, callback) {
                                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                                          Found in src/utils/dygraph.js - About 35 mins to fix

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

                                                                                                                                                                                                                            Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)<r&&r>1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};
                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 35 mins to fix

                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                            Dygraph.prototype.drawGraph_ = function() {
                                                                                                                                                                                                                                var start = new Date();
                                                                                                                                                                                                                            
                                                                                                                                                                                                                                // This is used to set the second parameter to drawCallback, below.
                                                                                                                                                                                                                                var is_initial_draw = this.is_initial_draw_;
                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 35 mins to fix

                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                            Dygraph.update = function (self, o) {
                                                                                                                                                                                                                                if (typeof(o) != 'undefined' && o !== null) {
                                                                                                                                                                                                                                    for (var k in o) {
                                                                                                                                                                                                                                        if (o.hasOwnProperty(k)) {
                                                                                                                                                                                                                                            self[k] = o[k];
                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 35 mins to fix

                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                            DygraphLayout.prototype.unstackPointAtIndex = function(idx) {
                                                                                                                                                                                                                                var point = this.points[idx];
                                                                                                                                                                                                                                // If the point is missing, no unstacking is necessary
                                                                                                                                                                                                                                if (!point.yval) {
                                                                                                                                                                                                                                    return point;
                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 35 mins to fix

                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                            Dygraph.isValidPoint = function(p, allowNaNY) {
                                                                                                                                                                                                                                if (!p) return false; // null or undefined object
                                                                                                                                                                                                                                if (p.yval === null) return false; // missing point
                                                                                                                                                                                                                                if (p.x === null || p.x === undefined) return false;
                                                                                                                                                                                                                                if (p.y === null || p.y === undefined) return false;
                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 35 mins to fix

                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                            Further reading

                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                            Open

                                                                                                                                                                                                                                            return mid;
                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 30 mins to fix

                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                      return Dygraph.binarySearch(val, arry, abs, mid + 1, high);
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in src/utils/dygraph.js - About 30 mins to fix

                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                        return self.attr_(opt);
                                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                                Found in src/utils/dygraph.js - About 30 mins to fix

                                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                          return data;
                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                  Found in src/utils/dygraph.js - About 30 mins to fix

                                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                            return parsedData;
                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                    Found in src/utils/dygraph.js - About 30 mins to fix

                                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                          if (isNaN(p.x) || (!allowNaNY && isNaN(p.y))) return false;
                                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                                      Found in src/utils/dygraph.js - About 30 mins to fix

                                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                                    return self.axes_[1][opt];
                                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                                        Found in src/utils/dygraph.js - About 30 mins to fix

                                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                                          Open

                                                                                                                                                                                                                                              return true;
                                                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                                                          Found in src/utils/dygraph.js - About 30 mins to fix

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

                                                                                                                                                                                                                                            Dygraph.dateAxisFormatter = function(date, granularity) {
                                                                                                                                                                                                                                                if (granularity >= Dygraph.DECADAL) {
                                                                                                                                                                                                                                                    return date.strftime('%Y');
                                                                                                                                                                                                                                                } else if (granularity >= Dygraph.MONTHLY) {
                                                                                                                                                                                                                                                    return date.strftime('%b %y');
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            DygraphRangeSelector.prototype.drawMiniPlot_ = function() {
                                                                                                                                                                                                                                                var fillStyle = this.attr_('rangeSelectorPlotFillColor');
                                                                                                                                                                                                                                                var strokeStyle = this.attr_('rangeSelectorPlotStrokeColor');
                                                                                                                                                                                                                                                if (!fillStyle && !strokeStyle) {
                                                                                                                                                                                                                                                    return;
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            Dygraph.compareArrays = function(array1, array2) {
                                                                                                                                                                                                                                                if (!Dygraph.isArrayLike(array1) || !Dygraph.isArrayLike(array2)) {
                                                                                                                                                                                                                                                    return false;
                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                if (array1.length !== array2.length) {
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            DygraphCanvasRenderer.isSupported = function(canvasName) {
                                                                                                                                                                                                                                                var canvas = null;
                                                                                                                                                                                                                                                try {
                                                                                                                                                                                                                                                    if (typeof(canvasName) == 'undefined' || canvasName === null) {
                                                                                                                                                                                                                                                        canvas = document.createElement("canvas");
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            DygraphLayout.prototype._evaluateAnnotations = function() {
                                                                                                                                                                                                                                                // Add the annotations to the point to which they belong.
                                                                                                                                                                                                                                                // Make a map from (setName, xval) to annotation for quick lookups.
                                                                                                                                                                                                                                                var i;
                                                                                                                                                                                                                                                var annotations = {};
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            Dygraph.prototype.animateSelection_ = function(direction) {
                                                                                                                                                                                                                                                var totalSteps = 10;
                                                                                                                                                                                                                                                var millis = 30;
                                                                                                                                                                                                                                                if (this.fadeLevel === undefined) this.fadeLevel = 0;
                                                                                                                                                                                                                                                if (this.animateId === undefined) this.animateId = 0;
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            Dygraph.prototype.findMaxXindex = function (arr) {
                                                                                                                                                                                                                                                if (this.maxXindex === null) {
                                                                                                                                                                                                                                                    this.maxXindex = 0;
                                                                                                                                                                                                                                                    var x2 = arr[0][0]
                                                                                                                                                                                                                                                    for (var maxi = 1; maxi < arr.length; maxi++){
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            Dygraph.prototype.findMinXindex = function (arr) {
                                                                                                                                                                                                                                                if (this.minXindex === null) {
                                                                                                                                                                                                                                                    this.minXindex = 0;
                                                                                                                                                                                                                                                    var x2 = arr[0][0]
                                                                                                                                                                                                                                                    for (var maxi = 1; maxi < arr.length; maxi++){
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            Dygraph.prototype.extractSeries_ = function(rawData, i, logScale) {
                                                                                                                                                                                                                                                var series = [];
                                                                                                                                                                                                                                                for (var j = 0; j < rawData.length; j++) {
                                                                                                                                                                                                                                                    var x = rawData[j][0];
                                                                                                                                                                                                                                                    var point = rawData[j][i];
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            DygraphRangeSelector.prototype.drawInteractiveLayer_ = function() {
                                                                                                                                                                                                                                                var ctx = this.fgcanvas_ctx_;
                                                                                                                                                                                                                                                ctx.clearRect(0, 0, this.canvasRect_.w, this.canvasRect_.h);
                                                                                                                                                                                                                                                var margin = 1;
                                                                                                                                                                                                                                                var width = this.canvasRect_.w - margin;
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js - About 25 mins to fix

                                                                                                                                                                                                                                            Cognitive Complexity

                                                                                                                                                                                                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                                                                                                                                            A method's cognitive complexity is based on a few simple rules:

                                                                                                                                                                                                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                                                                                                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                                                                                                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                                                                                                                                            Further reading

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

                                                                                                                                                                                                                                            Dygraph.findPosY = function(obj) {
                                                                                                                                                                                                                                                var curtop = 0;
                                                                                                                                                                                                                                                if(obj.offsetParent) {
                                                                                                                                                                                                                                                    var copyObj = obj;
                                                                                                                                                                                                                                                    while(1) {
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 6 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 5438..5458

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                            Dygraph.findPosX = function(obj) {
                                                                                                                                                                                                                                                var curleft = 0;
                                                                                                                                                                                                                                                if(obj.offsetParent) {
                                                                                                                                                                                                                                                    var copyObj = obj;
                                                                                                                                                                                                                                                    while(1) {
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 6 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 5465..5485

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                onCanvasTouchEvent = function(e) {
                                                                                                                                                                                                                                                    if (e.type == 'touchstart' && e.targetTouches.length == 1) {
                                                                                                                                                                                                                                                        if (onPanStart(e.targetTouches[0])) {
                                                                                                                                                                                                                                                            Dygraph.cancelEvent(e);
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 5 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 7270..7282

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                onZoomHandleTouchEvent = function(e) {
                                                                                                                                                                                                                                                    if (e.type == 'touchstart' && e.targetTouches.length == 1) {
                                                                                                                                                                                                                                                        if (onZoomStart(e.targetTouches[0])) {
                                                                                                                                                                                                                                                            Dygraph.cancelEvent(e);
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 5 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 7284..7296

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                            Dygraph.pageY = function(e) {
                                                                                                                                                                                                                                                if (e.pageY) {
                                                                                                                                                                                                                                                    return (!e.pageY || e.pageY < 0) ? 0 : e.pageY;
                                                                                                                                                                                                                                                } else {
                                                                                                                                                                                                                                                    var de = document;
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 4 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 5493..5503

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                            Dygraph.pageX = function(e) {
                                                                                                                                                                                                                                                if (e.pageX) {
                                                                                                                                                                                                                                                    return (!e.pageX || e.pageX < 0) ? 0 : e.pageX;
                                                                                                                                                                                                                                                } else {
                                                                                                                                                                                                                                                    var de = document;
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 4 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 5511..5521

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

                                                                                                                                                                                                                                            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.maxXindex === null) {
                                                                                                                                                                                                                                                    this.maxXindex = 0;
                                                                                                                                                                                                                                                    var x2 = arr[0][0]
                                                                                                                                                                                                                                                    for (var maxi = 1; maxi < arr.length; maxi++){
                                                                                                                                                                                                                                                        var elem = arr[maxi][0];
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2490..2500

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

                                                                                                                                                                                                                                            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.minXindex === null) {
                                                                                                                                                                                                                                                    this.minXindex = 0;
                                                                                                                                                                                                                                                    var x2 = arr[0][0]
                                                                                                                                                                                                                                                    for (var maxi = 1; maxi < arr.length; maxi++){
                                                                                                                                                                                                                                                        var elem = arr[maxi][0];
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2471..2481

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

                                                                                                                                                                                                                                            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 (isDate) {
                                                                                                                                                                                                                                                    this.attrs_.xValueParser = Dygraph.dateParser;
                                                                                                                                                                                                                                                    this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
                                                                                                                                                                                                                                                    this.attrs_.axes.x.ticker = Dygraph.dateTicker;
                                                                                                                                                                                                                                                    this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 4735..4749

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                if (indepType == 'date' || indepType == 'datetime') {
                                                                                                                                                                                                                                                    this.attrs_.xValueParser = Dygraph.dateParser;
                                                                                                                                                                                                                                                    this.attrs_.axes.x.valueFormatter = Dygraph.dateString_;
                                                                                                                                                                                                                                                    this.attrs_.axes.x.ticker = Dygraph.dateTicker;
                                                                                                                                                                                                                                                    this.attrs_.axes.x.axisLabelFormatter = Dygraph.dateAxisFormatter;
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 4453..4466

                                                                                                                                                                                                                                            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 (context.touchDirections.x) {
                                                                                                                                                                                                                                                    g.dateWindow_ = [
                                                                                                                                                                                                                                                        c_init.dataX - swipe.dataX + (context.initialRange.x[0] - c_init.dataX) / xScale,
                                                                                                                                                                                                                                                        c_init.dataX - swipe.dataX + (context.initialRange.x[1] - c_init.dataX) / xScale
                                                                                                                                                                                                                                                    ];
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 6747..6752

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

                                                                                                                                                                                                                                            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 {
                                                                                                                                                                                                                                                            axis.valueWindow = [
                                                                                                                                                                                                                                                                c_init.dataY - swipe.dataY + (context.initialRange.y[0] - c_init.dataY) / yScale,
                                                                                                                                                                                                                                                                c_init.dataY - swipe.dataY + (context.initialRange.y[1] - c_init.dataY) / yScale
                                                                                                                                                                                                                                                            ];
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 6735..6740

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                        ctx.fillRect(this.layout_.getPlotArea().x, Math.min(startY, endY),
                                                                                                                                                                                                                                                            this.layout_.getPlotArea().w, Math.abs(endY - startY));
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2960..2961

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                    ctx.clearRect(Math.min(startX, prevEndX), this.layout_.getPlotArea().y,
                                                                                                                                                                                                                                                        Math.abs(startX - prevEndX), this.layout_.getPlotArea().h);
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2968..2969

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                        ctx.fillRect(Math.min(startX, endX), this.layout_.getPlotArea().y,
                                                                                                                                                                                                                                                            Math.abs(endX - startX), this.layout_.getPlotArea().h);
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2957..2958

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                    ctx.clearRect(this.layout_.getPlotArea().x, Math.min(startY, prevEndY),
                                                                                                                                                                                                                                                        this.layout_.getPlotArea().w, Math.abs(startY - prevEndY));
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2974..2975

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

                                                                                                                                                                                                                                            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 (regionWidth < 2 && regionHeight < 2 &&
                                                                                                                                                                                                                                                        g.lastx_ !== undefined && g.lastx_ != -1) {
                                                                                                                                                                                                                                                        Dygraph.Interaction.treatMouseOpAsClick(g, event, context);
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 6601..6604

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

                                                                                                                                                                                                                                            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 (regionWidth < 2 && regionHeight < 2 &&
                                                                                                                                                                                                                                                    g.lastx_ !== undefined && g.lastx_ != -1) {
                                                                                                                                                                                                                                                    Dygraph.Interaction.treatMouseOpAsClick(g, event, context);
                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 6865..6868

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

                                                                                                                                                                                                                                            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 (regionHeight >= 10 && context.dragDirection == Dygraph.VERTICAL) {
                                                                                                                                                                                                                                                    g.doZoomY_(Math.min(context.dragStartY, context.dragEndY),
                                                                                                                                                                                                                                                        Math.max(context.dragStartY, context.dragEndY));
                                                                                                                                                                                                                                                    context.cancelNextDblclick = true;
                                                                                                                                                                                                                                                } else {
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 6606..6616

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

                                                                                                                                                                                                                                            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 (regionWidth >= 10 && context.dragDirection == Dygraph.HORIZONTAL) {
                                                                                                                                                                                                                                                    g.doZoomX_(Math.min(context.dragStartX, context.dragEndX),
                                                                                                                                                                                                                                                        Math.max(context.dragStartX, context.dragEndX));
                                                                                                                                                                                                                                                    context.cancelNextDblclick = true;
                                                                                                                                                                                                                                                } else if (regionHeight >= 10 && context.dragDirection == Dygraph.VERTICAL) {
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 6610..6616

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                mouseup: function(event, g, context) {
                                                                                                                                                                                                                                                    if (context.isZooming) {
                                                                                                                                                                                                                                                        Dygraph.endZoom(event, g, context);
                                                                                                                                                                                                                                                    } else if (context.isPanning) {
                                                                                                                                                                                                                                                        Dygraph.endPan(event, g, context);
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 6794..6800

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                mousemove: function(event, g, context) {
                                                                                                                                                                                                                                                    if (context.isZooming) {
                                                                                                                                                                                                                                                        Dygraph.moveZoom(event, g, context);
                                                                                                                                                                                                                                                    } else if (context.isPanning) {
                                                                                                                                                                                                                                                        Dygraph.movePan(event, g, context);
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 6802..6808

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

                                                                                                                                                                                                                                            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.attr_('y2label') && this.dygraph_.numAxes() == 2) {
                                                                                                                                                                                                                                                    div = createRotatedDiv(2, 'dygraph-label dygraph-y2label',
                                                                                                                                                                                                                                                        this.attr_('y2label'));
                                                                                                                                                                                                                                                    this.container.appendChild(div);
                                                                                                                                                                                                                                                    this.chartLabels.y2label = div;
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 989..994

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

                                                                                                                                                                                                                                            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.attr_('ylabel')) {
                                                                                                                                                                                                                                                    div = createRotatedDiv(1, 'dygraph-label dygraph-ylabel',
                                                                                                                                                                                                                                                        this.attr_('ylabel'));
                                                                                                                                                                                                                                                    this.container.appendChild(div);
                                                                                                                                                                                                                                                    this.chartLabels.ylabel = div;
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 995..1000

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

                                                                                                                                                                                                                                            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.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 2 other locations - About 55 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8281..8281
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8282..8282

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

                                                                                                                                                                                                                                            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.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 2 other locations - About 55 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8280..8280
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8282..8282

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

                                                                                                                                                                                                                                            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.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 2 other locations - About 55 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8280..8280
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8281..8281

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

                                                                                                                                                                                                                                            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 (outOfOrder) {
                                                                                                                                                                                                                                                    this.warn("DataTable is out of order; order it correctly to speed loading.");
                                                                                                                                                                                                                                                    ret.sort(function(a,b) { return a[0] - b[0]; });
                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 50 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 4639..4642

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

                                                                                                                                                                                                                                            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 (outOfOrder) {
                                                                                                                                                                                                                                                    this.warn("CSV is out of order; order it correctly to speed loading.");
                                                                                                                                                                                                                                                    ret.sort(function(a,b) { return a[0] - b[0]; });
                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 50 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 4837..4840

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                        err_color = 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' +
                                                                                                                                                                                                                                                            fillAlpha + ')';
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 50 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 1357..1358

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                        err_color = 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' +
                                                                                                                                                                                                                                                            fillAlpha + ')';
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 50 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 1426..1427

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

                                                                                                                                                                                                                                            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 (ret.length > 0 && row[0] < ret[ret.length - 1][0]) {
                                                                                                                                                                                                                                                        outOfOrder = true;
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 45 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 4610..4612

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 50.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

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

                                                                                                                                                                                                                                                    if (ret.length > 0 && fields[0] < ret[ret.length - 1][0]) {
                                                                                                                                                                                                                                                        outOfOrder = true;
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 45 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 4831..4833

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 50.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

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

                                                                                                                                                                                                                                                    if (abs > 0) {
                                                                                                                                                                                                                                                        // Accept if element > val, but also if prior element < val.
                                                                                                                                                                                                                                                        idx = mid - 1;
                                                                                                                                                                                                                                                        if (validIndex(idx) && arry[idx] < val) {
                                                                                                                                                                                                                                                            return mid;
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 45 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 5674..5680

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 50.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

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

                                                                                                                                                                                                                                                    if (abs < 0) {
                                                                                                                                                                                                                                                        // Accept if element < val, but also if prior element > val.
                                                                                                                                                                                                                                                        idx = mid + 1;
                                                                                                                                                                                                                                                        if (validIndex(idx) && arry[idx] > val) {
                                                                                                                                                                                                                                                            return mid;
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 45 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 5664..5670

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 50.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

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

                                                                                                                                                                                                                                                    this.startSegment = function() {
                                                                                                                                                                                                                                                        ctx.beginPath();
                                                                                                                                                                                                                                                        ctx.strokeStyle = color;
                                                                                                                                                                                                                                                        ctx.lineWidth = strokeWidth;
                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 40 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 1171..1175

                                                                                                                                                                                                                                            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

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

                                                                                                                                                                                                                                                    this.init = function() {
                                                                                                                                                                                                                                                        ctx.beginPath();
                                                                                                                                                                                                                                                        ctx.strokeStyle = color;
                                                                                                                                                                                                                                                        ctx.lineWidth = strokeWidth;
                                                                                                                                                                                                                                                    };
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 40 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 1150..1154

                                                                                                                                                                                                                                            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

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

                                                                                                                                                                                                                                                    for (var name in annotationStyle) {
                                                                                                                                                                                                                                                        if (annotationStyle.hasOwnProperty(name)) {
                                                                                                                                                                                                                                                            div.style[name] = annotationStyle[name];
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 730..734

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

                                                                                                                                                                                                                                            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 (var name in labelStyle) {
                                                                                                                                                                                                                                                        if (labelStyle.hasOwnProperty(name)) {
                                                                                                                                                                                                                                                            div.style[name] = labelStyle[name];
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 1039..1043

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                        ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h);
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 489..489

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

                                                                                                                                                                                                                                            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

                                                                                                                                                                                                                                                        ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h);
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 494..494

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

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

                                                                                                                                                                                                                                            Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)<r&&r>1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};
                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8301..8301
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8301..8301
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 8301..8301

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 45.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

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

                                                                                                                                                                                                                                            Dygraph.prototype.dragGetY_ = function(e, context) {
                                                                                                                                                                                                                                                return Dygraph.pageY(e) - context.py;
                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 30 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2813..2815

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 45.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

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

                                                                                                                                                                                                                                            Dygraph.prototype.toDomCoords = function(x, y, axis) {
                                                                                                                                                                                                                                                return [ this.toDomXCoord(x), this.toDomYCoord(y, axis) ];
                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 30 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2330..2332

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 45.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

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

                                                                                                                                                                                                                                            Dygraph.prototype.toDataCoords = function(x, y, axis) {
                                                                                                                                                                                                                                                return [ this.toDataXCoord(x), this.toDataYCoord(y, axis) ];
                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 30 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2285..2287

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 45.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

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

                                                                                                                                                                                                                                            Dygraph.prototype.dragGetX_ = function(e, context) {
                                                                                                                                                                                                                                                return Dygraph.pageX(e) - context.px;
                                                                                                                                                                                                                                            };
                                                                                                                                                                                                                                            Severity: Minor
                                                                                                                                                                                                                                            Found in src/utils/dygraph.js and 1 other location - About 30 mins to fix
                                                                                                                                                                                                                                            src/utils/dygraph.js on lines 2822..2824

                                                                                                                                                                                                                                            Duplicated Code

                                                                                                                                                                                                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                                                                            Tuning

                                                                                                                                                                                                                                            This issue has a mass of 45.

                                                                                                                                                                                                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                                                                            Refactorings

                                                                                                                                                                                                                                            Further Reading

                                                                                                                                                                                                                                            There are no issues that match your filters.

                                                                                                                                                                                                                                            Category
                                                                                                                                                                                                                                            Status