kosmatov/sidekiq-benchmark

View on GitHub

Showing 50 of 50 total issues

Function createDataTable has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  defaultExport$2.prototype.createDataTable = function createDataTable (series, columnType) {
    var i, j, s, d, key, rows = [], sortedLabels = [];
    for (i = 0; i < series.length; i++) {
      s = series[i];
      series[i].name = series[i].name || "Value";
Severity: Minor
Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

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

      var setXtitle = function (options, title) {
        options.scales.xAxes[0].scaleLabel.display = true;
        options.scales.xAxes[0].scaleLabel.labelString = title;
      };
    Severity: Major
    Found in web/assets/javascripts/chartkick.js and 1 other location - About 1 hr to fix
    web/assets/javascripts/chartkick.js on lines 456..459

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

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

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

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

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

    Refactorings

    Further Reading

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

      var setYtitle = function (options, title) {
        options.scales.yAxes[0].scaleLabel.display = true;
        options.scales.yAxes[0].scaleLabel.labelString = title;
      };
    Severity: Major
    Found in web/assets/javascripts/chartkick.js and 1 other location - About 1 hr to fix
    web/assets/javascripts/chartkick.js on lines 451..454

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

    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

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

      function addDownloadButton(chart) {
        var element = chart.element;
        var link = document.createElement("a");
    
        var download = chart.options.download;
    Severity: Minor
    Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

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

        defaultExport$1.prototype.renderColumnChart = function renderColumnChart (chart, chartType) {
          chartType = chartType || "column";
          var series = chart.data;
          var options = jsOptions$1(chart, chart.options), i, j, s, d, rows = [], categories = [];
          options.chart.type = chartType;
      Severity: Minor
      Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

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

          function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {
            return function (chart, opts, chartOptions) {
              var series = chart.data;
              var options = merge({}, defaultOptions);
              options = merge(options, chartOptions || {});
        Severity: Minor
        Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

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

            defaultExport.prototype.renderPieChart = function renderPieChart (chart) {
              var options = merge({}, baseOptions);
              if (chart.options.donut) {
                options.cutoutPercentage = 50;
              }
          Severity: Minor
          Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

            Function parseISO8601 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function parseISO8601(input) {
                var day, hour, matches, milliseconds, minutes, month, offset, result, seconds, type, year;
                type = Object.prototype.toString.call(input);
                if (type === "[object Date]") {
                  return input;
            Severity: Minor
            Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

              Function renderPieChart has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                defaultExport$2.prototype.renderPieChart = function renderPieChart (chart) {
                    var this$1 = this;
              
                  this.waitForLoaded(chart, function () {
                    var chartOptions = {
              Severity: Minor
              Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

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

                  var setMin = function (options, min) {
                    if (min !== null) {
                      options.scales.yAxes[0].ticks.min = toFloat(min);
                    }
                  };
                Severity: Major
                Found in web/assets/javascripts/chartkick.js and 1 other location - About 1 hr to fix
                web/assets/javascripts/chartkick.js on lines 436..440

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 56.

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

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

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

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

                Refactorings

                Further Reading

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

                  var setBarMin = function (options, min) {
                    if (min !== null) {
                      options.scales.xAxes[0].ticks.min = toFloat(min);
                    }
                  };
                Severity: Major
                Found in web/assets/javascripts/chartkick.js and 1 other location - About 1 hr to fix
                web/assets/javascripts/chartkick.js on lines 426..430

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

                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

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

                  function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {
                Severity: Major
                Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (chart.xtype === "datetime") {
                            value = new Date(toFloat(i));
                            // TODO make this efficient
                            day = day && isDay(value);
                            if (!dayOfWeek) {
                  Severity: Major
                  Found in web/assets/javascripts/chartkick.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                              if (label) {
                                label += ': ';
                              }
                    Severity: Major
                    Found in web/assets/javascripts/chartkick.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if (isArray(dataLabel)) {
                                  // show value on first line of multiline label
                                  // need to clone because we are changing the value
                                  dataLabel = dataLabel.slice();
                                  dataLabel[0] += value;
                      Severity: Major
                      Found in web/assets/javascripts/chartkick.js - About 45 mins to fix

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

                              if (notnull(xmin)) {
                                options.scales.xAxes[0][ticksKey].min = toDate(xmin).getTime();
                              }
                        Severity: Minor
                        Found in web/assets/javascripts/chartkick.js and 1 other location - About 40 mins to fix
                        web/assets/javascripts/chartkick.js on lines 755..757

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

                        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 (notnull(xmax)) {
                                options.scales.xAxes[0][ticksKey].max = toDate(xmax).getTime();
                              }
                        Severity: Minor
                        Found in web/assets/javascripts/chartkick.js and 1 other location - About 40 mins to fix
                        web/assets/javascripts/chartkick.js on lines 752..754

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

                        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

                        Consider simplifying this complex logical expression.
                        Open

                              if ((options.xmin || options.xmax) && (!options.xmin || isDate(options.xmin)) && (!options.xmax || isDate(options.xmax))) {
                                return "datetime";
                              } else {
                                return "number";
                              }
                        Severity: Major
                        Found in web/assets/javascripts/chartkick.js - About 40 mins to fix

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

                            defaultExport$1.prototype.destroy = function destroy (chart) {
                              if (chart.chart) {
                                chart.chart.destroy();
                              }
                            };
                          Severity: Minor
                          Found in web/assets/javascripts/chartkick.js and 2 other locations - About 40 mins to fix
                          web/assets/javascripts/chartkick.js on lines 961..965
                          web/assets/javascripts/chartkick.js on lines 1558..1562

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

                            defaultExport.prototype.destroy = function destroy (chart) {
                              if (chart.chart) {
                                chart.chart.destroy();
                              }
                            };
                          Severity: Minor
                          Found in web/assets/javascripts/chartkick.js and 2 other locations - About 40 mins to fix
                          web/assets/javascripts/chartkick.js on lines 1249..1253
                          web/assets/javascripts/chartkick.js on lines 1558..1562

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language