Showing 14 of 22 total issues
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';
Function parseBorderWidth
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function parseBorderWidth(vm) {
var value = vm.borderWidth;
var skip = parseBorderSkipped(vm);
var maxW, maxH, t, r, b, l;
- 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 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;
Function draw
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function() {
var me = this;
var chart = me.chart;
var globalDefaults = defaults.global;
var each = helpers.each;
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 || {};
Function generateLabels
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
defaults.global.legend.labels.generateLabels = function(chart) {
var data = chart.data;
var options = chart.options.legend || {};
var usePointStyle = options.labels && options.labels.usePointStyle;
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 || {};
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;
Function resolve
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
resolve: optionsHelpers.resolve || function(inputs, context, index) {
var i, ilen, value;
for (i = 0, ilen = inputs.length; i < ilen; ++i) {
value = inputs[i];
- 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
Consider simplifying this complex logical expression. Open
if (value !== null && Object.prototype.toString.call(value) === '[object Object]') {
t = +value.top || 0;
r = +value.right || 0;
b = +value.bottom || 0;
l = +value.left || 0;
Function descriptors
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
plugins.descriptors = function(chart) {
var style = chart._style;
// Replace legend plugin with style legend plugin
if (style) {
- 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 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;
- 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 drawBackground
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
drawBackground: function(pt, vm, ctx, tooltipSize, opacity) {
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;
- 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"