nagix/chartjs-plugin-style

View on GitHub
src/helpers/helpers.style.js

Summary

Maintainability
C
1 day
Test Coverage

File helpers.style.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

import Chart from 'chart.js';
import optionsHelpers from './helpers.options';

Severity: Minor
Found in src/helpers/helpers.style.js - About 3 hrs to fix

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

        drawBevel: function(chart, options, drawCallback) {
            var ctx = chart.ctx;
            var pixelRatio = chart.currentDevicePixelRatio;
            var shadowWidthFactor = pixelRatio * 5 / 6;
            var width = options.bevelWidth * shadowWidthFactor;
    Severity: Minor
    Found in src/helpers/helpers.style.js - About 1 hr to fix

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

          resolvePointStyle: function(controller, element, index, options) {
              var me = this;
              var chart = controller.chart;
              var dataset = chart.data.datasets[controller.index];
              var custom = element.custom || {};
      Severity: Minor
      Found in src/helpers/helpers.style.js - About 1 hr to fix

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

            resolveStyle: function(controller, element, index, options) {
                var me = this;
                var chart = controller.chart;
                var dataset = chart.data.datasets[controller.index];
                var custom = element.custom || {};
        Severity: Minor
        Found in src/helpers/helpers.style.js - About 1 hr to fix

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

              drawGlow: function(chart, options, drawCallback, isOuter) {
                  var ctx = chart.ctx;
                  var width = isOuter ? options.outerGlowWidth : options.innerGlowWidth;
                  var borderWidth = options.borderWidth;
                  var pixelRatio = chart.currentDevicePixelRatio;
          Severity: Minor
          Found in src/helpers/helpers.style.js - About 1 hr to fix

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

                drawBevel: function(chart, options, drawCallback) {
                    var ctx = chart.ctx;
                    var pixelRatio = chart.currentDevicePixelRatio;
                    var shadowWidthFactor = pixelRatio * 5 / 6;
                    var width = options.bevelWidth * shadowWidthFactor;
            Severity: Minor
            Found in src/helpers/helpers.style.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 drawGlow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                drawGlow: function(chart, options, drawCallback, isOuter) {
                    var ctx = chart.ctx;
                    var width = isOuter ? options.outerGlowWidth : options.innerGlowWidth;
                    var borderWidth = options.borderWidth;
                    var pixelRatio = chart.currentDevicePixelRatio;
            Severity: Minor
            Found in src/helpers/helpers.style.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

            There are no issues that match your filters.

            Category
            Status