src/helpers/helpers.style.js
File helpers.style.js
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
import Chart from 'chart.js';
import optionsHelpers from './helpers.options';
Function drawBevel
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
drawBevel: function(chart, options, drawCallback) {
var ctx = chart.ctx;
var pixelRatio = chart.currentDevicePixelRatio;
var shadowWidthFactor = pixelRatio * 5 / 6;
var width = options.bevelWidth * shadowWidthFactor;
Function resolvePointStyle
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 || {};
Function resolveStyle
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 || {};
Function drawGlow
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Function drawBevel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
drawBevel: function(chart, options, drawCallback) {
var ctx = chart.ctx;
var pixelRatio = chart.currentDevicePixelRatio;
var shadowWidthFactor = pixelRatio * 5 / 6;
var width = options.bevelWidth * shadowWidthFactor;
- Read upRead up
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
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;
- Read upRead up
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"