Showing 191 of 245 total issues
Function splineCurveMonotone
has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring. Open
export function splineCurveMonotone(points: SplinePoint[], indexAxis: 'x' | 'y' = 'x') {
const valueAxis = getValueAxis(indexAxis);
const pointsLen = points.length;
const deltaK: number[] = Array(pointsLen).fill(0);
const mK: number[] = Array(pointsLen);
- 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 lttbDecimation
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lttbDecimation(data, start, count, availableWidth, options) {
/**
* Implementation of the Largest Triangle Three Buckets algorithm.
*
* This implementation is based on the original implementation by Sveinn Steinarsson
Function drawLegendBox
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
const drawLegendBox = function(x, y, legendItem) {
if (isNaN(boxWidth) || boxWidth <= 0 || isNaN(boxHeight) || boxHeight < 0) {
return;
}
Function solidSegments
has a Cognitive Complexity of 16 (exceeds 7 allowed). Consider refactoring. Open
function solidSegments(points, start, max, loop) {
const count = points.length;
const result = [];
let last = start;
let prev = points[start];
- 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 _createAnimations
has a Cognitive Complexity of 16 (exceeds 7 allowed). Consider refactoring. Open
_createAnimations(target, values) {
const animatedProps = this._properties;
const animations = [];
const running = target.$animations || (target.$animations = {});
const props = Object.keys(values);
- 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 drawGrid
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawGrid(chartArea) {
const grid = this.options.grid;
const ctx = this.ctx;
const items = this._gridLineItems || (this._gridLineItems = this._computeGridLineItems(chartArea));
let i, ilen;
Function constructor
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(_descriptors, _appliers) {
this.animation = undefined;
this.backgroundColor = 'rgba(0,0,0,0.1)';
this.borderColor = 'rgba(0,0,0,0.1)';
this.color = '#666';
Function fastPathSegment
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fastPathSegment(ctx, line, segment, params) {
const points = line.points;
const {count, start, ilen} = pathVars(points, segment, params);
const {move = true, reverse} = params || {};
let avgX = 0;
Function getCaretPosition
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
getCaretPosition(tooltipPoint, size, options) {
const {xAlign, yAlign} = this;
const {caretSize, cornerRadius} = options;
const {topLeft, topRight, bottomLeft, bottomRight} = toTRBLCorners(cornerRadius);
const {x: ptX, y: ptY} = tooltipPoint;
Function update
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
update(changed, replay) {
const options = this.options.setContext(this.getContext());
const active = this._active;
let properties;
let tooltipItems = [];
Function _computeLabelSizes
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
_computeLabelSizes(ticks, length, maxTicksLimit) {
const {ctx, _longestTextCache: caches} = this;
const widths = [];
const heights = [];
const increment = Math.floor(length / getTicksLimit(length, maxTicksLimit));
Function drawBody
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawBody(pt, ctx, options) {
const {body} = this;
const {bodySpacing, bodyAlign, displayColors, boxHeight, boxWidth, boxPadding} = options;
const bodyFont = toFont(options.bodyFont);
let bodyLineHeight = bodyFont.lineHeight;
Function fit
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
fit() {
// Reset
const minSize = {
width: 0,
height: 0
Function bindResponsiveEvents
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
bindResponsiveEvents() {
if (!this._responsiveListeners) {
this._responsiveListeners = {};
}
const listeners = this._responsiveListeners;
Function drawGrid
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawGrid() {
const ctx = this.ctx;
const opts = this.options;
const {angleLines, grid, border} = opts;
const labelCount = this._pointLabels.length;
Function _attachContext
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function _attachContext<
T extends AnyObject[] = AnyObject[],
R extends AnyObject[] = T
>(
proxy: ResolverProxy<T, R>,
Function fastPathSegment
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
function fastPathSegment(ctx, line, segment, params) {
const points = line.points;
const {count, start, ilen} = pathVars(points, segment, params);
const {move = true, reverse} = params || {};
let avgX = 0;
- 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 _calculateBarValuePixels
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
_calculateBarValuePixels(index) {
const {_cachedMeta: {vScale, _stacked, index: datasetIndex}, options: {base: baseValue, minBarLength}} = this;
const actualBase = baseValue || 0;
const parsed = this.getParsed(index);
const custom = parsed._custom;
- 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 _getStacks
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
_getStacks(last, dataIndex) {
const {iScale} = this._cachedMeta;
const metasets = iScale.getMatchingVisibleMetas(this._type)
.filter(meta => meta.controller.options.grouped);
const stacked = iScale.options.stacked;
- 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 updateElements
has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring. Open
updateElements(points, start, count, mode) {
const reset = mode === 'reset';
const {iScale, vScale} = this._cachedMeta;
const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);
const iAxis = iScale.axis;
- 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"