jiskattema/spot

View on GitHub
src/widgets/chartjs-errorbars.js

Summary

Maintainability
C
1 day
Test Coverage

Function exports has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (Chart, chartType, newType) {
  var helpers = Chart.helpers;

  // ErrorBar element
  Chart.elements.ErrorBar = Chart.elements.ErrorBar || Chart.Element.extend({
Severity: Major
Found in src/widgets/chartjs-errorbars.js - About 6 hrs to fix

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

    module.exports = function (Chart, chartType, newType) {
      var helpers = Chart.helpers;
    
      // ErrorBar element
      Chart.elements.ErrorBar = Chart.elements.ErrorBar || Chart.Element.extend({
    Severity: Minor
    Found in src/widgets/chartjs-errorbars.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 draw has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        draw: function () {
          var ctx = this._chart.ctx;
          var vm = this._view;
    
          if (vm.direction === 'none') {
    Severity: Minor
    Found in src/widgets/chartjs-errorbars.js - About 1 hr to fix

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

          updateErrorBar: function updateErrorBar (errorBar, element, index, reset) {
            var dataset = this.getDataset();
            var meta = this.getMeta();
            var xScale = this.getScaleForId(meta.xAxisID);
            var yScale = this.getScaleForId(meta.yAxisID);
      Severity: Minor
      Found in src/widgets/chartjs-errorbars.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                  if ((e.x !== null && e.x !== undefined && !isNaN(e.x)) || (e.y !== null && e.y !== undefined && !isNaN(e.y))) {
                    errorBar.transition(easingDecimal).draw();
                  }
        Severity: Major
        Found in src/widgets/chartjs-errorbars.js - About 40 mins to fix

          There are no issues that match your filters.

          Category
          Status