Showing 191 of 245 total issues
File index.d.ts
has 1611 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/ban-types */
import {DeepPartial, DistributiveArray, UnionToIntersection} from './utils.js';
import {TimeUnit} from '../core/core.adapters.js';
import PointElement from '../elements/element.point.js';
File core.scale.js
has 1223 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Element from './core.element.js';
import {_alignPixel, _measureText, renderText, clipArea, unclipArea} from '../helpers/helpers.canvas.js';
import {callback as call, each, finiteOrDefault, isArray, isFinite, isNullOrUndef, isObject, valueOrDefault} from '../helpers/helpers.core.js';
import {toDegrees, toRadians, _int16Range, _limitValue, HALF_PI} from '../helpers/helpers.math.js';
import {_alignStartEnd, _toLeftRightCenter} from '../helpers/helpers.extras.js';
File plugin.tooltip.js
has 976 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Animations from '../core/core.animations.js';
import Element from '../core/core.element.js';
import {addRoundedRectPath} from '../helpers/helpers.canvas.js';
import {each, noop, isNullOrUndef, isArray, _elementsEqual, isObject} from '../helpers/helpers.core.js';
import {toFont, toPadding, toTRBLCorners} from '../helpers/helpers.options.js';
File core.controller.js
has 878 lines of code (exceeds 250 allowed). Consider refactoring. Open
import animator from './core.animator.js';
import defaults, {overrides} from './core.defaults.js';
import Interaction from './core.interaction.js';
import layouts from './core.layouts.js';
import {_detectPlatform} from '../platform/index.js';
File core.datasetController.js
has 743 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Animations from './core.animations.js';
import defaults from './core.defaults.js';
import {isArray, isFinite, isObject, valueOrDefault, resolveObjectKey, defined} from '../helpers/helpers.core.js';
import {listenArrayEvents, unlistenArrayEvents} from '../helpers/helpers.collection.js';
import {createContext, sign} from '../helpers/index.js';
Function _computeLabelItems
has a Cognitive Complexity of 78 (exceeds 7 allowed). Consider refactoring. Open
_computeLabelItems(chartArea) {
const axis = this.axis;
const options = this.options;
const {position, ticks: optionTicks} = options;
const isHorizontal = this.isHorizontal();
- 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
Scale
has 68 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Scale extends Element {
// eslint-disable-next-line max-statements
constructor(cfg) {
super();
Chart
has 64 functions (exceeds 20 allowed). Consider refactoring. Open
class Chart {
static defaults = defaults;
static instances = instances;
static overrides = overrides;
File plugin.legend.js
has 525 lines of code (exceeds 250 allowed). Consider refactoring. Open
import defaults from '../core/core.defaults.js';
import Element from '../core/core.element.js';
import layouts from '../core/core.layouts.js';
import {addRoundedRectPath, drawPointLegend, renderText} from '../helpers/helpers.canvas.js';
import {
File scale.radialLinear.js
has 500 lines of code (exceeds 250 allowed). Consider refactoring. Open
import defaults from '../core/core.defaults.js';
import {_longestText, addRoundedRectPath, renderText, _isPointInArea} from '../helpers/helpers.canvas.js';
import {HALF_PI, TAU, toDegrees, toRadians, _normalizeAngle, PI} from '../helpers/helpers.math.js';
import LinearScaleBase from './scale.linearbase.js';
import Ticks from '../core/core.ticks.js';
DatasetController
has 55 functions (exceeds 20 allowed). Consider refactoring. Open
export default class DatasetController {
/**
* @type {any}
*/
File controller.bar.js
has 470 lines of code (exceeds 250 allowed). Consider refactoring. Open
import DatasetController from '../core/core.datasetController.js';
import {
_arrayUnique, isArray, isNullOrUndef,
valueOrDefault, resolveObjectKey, sign, defined
} from '../helpers/index.js';
Function _computeLabelItems
has 164 lines of code (exceeds 25 allowed). Consider refactoring. Open
_computeLabelItems(chartArea) {
const axis = this.axis;
const options = this.options;
const {position, ticks: optionTicks} = options;
const isHorizontal = this.isHorizontal();
Function drawPointLegend
has a Cognitive Complexity of 42 (exceeds 7 allowed). Consider refactoring. Open
export function drawPointLegend(
ctx: CanvasRenderingContext2D,
options: DrawPointOptions,
x: number,
y: number,
- 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 generateTicks
has a Cognitive Complexity of 38 (exceeds 7 allowed). Consider refactoring. Open
function generateTicks(generationOptions, dataRange) {
const ticks = [];
// To get a "nice" value for the tick spacing, we will use the appropriately named
// "nice number" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks
// for details.
- 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
File helpers.canvas.ts
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type {
Chart,
Point,
FontSpec,
CanvasFontSpec,
File scale.time.js
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
import adapters from '../core/core.adapters.js';
import {callback as call, isFinite, isNullOrUndef, mergeIf, valueOrDefault} from '../helpers/helpers.core.js';
import {toRadians, isNumber, _limitValue} from '../helpers/helpers.math.js';
import Scale from '../core/core.scale.js';
import {_arrayUnique, _filterBetween, _lookup} from '../helpers/helpers.collection.js';
Function drawPointLegend
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function drawPointLegend(
ctx: CanvasRenderingContext2D,
options: DrawPointOptions,
x: number,
y: number,
Function _draw
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
_draw() {
const {options: opts, columnSizes, lineWidths, ctx} = this;
const {align, labels: labelOpts} = opts;
const defaultColor = defaults.color;
const rtlHelper = getRtlAdapter(opts.rtl, this.left, this.width);
Function _computeGridLineItems
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
_computeGridLineItems(chartArea) {
const axis = this.axis;
const chart = this.chart;
const options = this.options;
const {grid, position, border} = options;