Showing 191 of 245 total issues
Function _draw
has a Cognitive Complexity of 15 (exceeds 7 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);
- 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 drawLabels
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawLabels() {
const ctx = this.ctx;
const opts = this.options;
const tickOpts = opts.ticks;
Function _boundSegment
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function _boundSegment(segment, points, bounds) {
if (!bounds) {
return [segment];
}
Function _calculatePadding
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
_calculatePadding(first, last, sin, cos) {
const {ticks: {align, padding}, position} = this.options;
const isRotated = this.labelRotation !== 0;
const labelsBelowTicks = position !== 'top' && this.axis === 'x';
Function updateElements
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateElements(arcs, start, count, mode) {
const reset = mode === 'reset';
const chart = this.chart;
const opts = chart.options;
const animationOpts = opts.animation;
Function placeBoxes
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function placeBoxes(boxes, chartArea, params, stacks) {
const userPadding = params.padding;
let {x, y} = chartArea;
for (const layout of boxes) {
Function _update
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_update(date = Date.now()) {
let remaining = 0;
this._charts.forEach((anims, chart) => {
if (!anims.running || !anims.items.length) {
Function update
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
update(mode) {
const config = this.config;
config.update();
const options = this._options = config.createResolver(config.chartOptionScopes(), this.getContext());
Function _segments
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function _segments(line, target, property) {
const segments = line.segments;
const points = line.points;
const tpoints = target.points;
const parts = [];
Function updateElements
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateElements(points, start, count, mode) {
const reset = mode === 'reset';
const {iScale, vScale, _stacked, _dataset} = this._cachedMeta;
const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);
const iAxis = iScale.axis;
Function _calculatePadding
has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring. Open
_calculatePadding(first, last, sin, cos) {
const {ticks: {align, padding}, position} = this.options;
const isRotated = this.labelRotation !== 0;
const labelsBelowTicks = position !== 'top' && this.axis === 'x';
- 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 14 (exceeds 7 allowed). Consider refactoring. Open
updateElements(arcs, start, count, mode) {
const reset = mode === 'reset';
const chart = this.chart;
const opts = chart.options;
const animationOpts = opts.animation;
- 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 14 (exceeds 7 allowed). Consider refactoring. Open
function generateTicks(generationOptions, {min, max}) {
min = finiteOrDefault(generationOptions.min, min);
const ticks = [];
const minExp = log10Floor(min);
let exp = startExp(min, max);
- 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 _longestText
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function _longestText(
ctx: CanvasRenderingContext2D,
font: string,
arrayOfThings: Things,
cache?: {data?: Record<string, number>, garbageCollect?: string[], font?: string}
Function drawBackground
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawBackground(pt, ctx, tooltipSize, options) {
const {xAlign, yAlign} = this;
const {x, y} = pt;
const {width, height} = tooltipSize;
const {topLeft, topRight, bottomLeft, bottomRight} = toTRBLCorners(options.cornerRadius);
Function _createAnimations
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createAnimations(target, values) {
const animatedProps = this._properties;
const animations = [];
const running = target.$animations || (target.$animations = {});
const props = Object.keys(values);
Function buildOrUpdateControllers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildOrUpdateControllers() {
const newControllers = [];
const datasets = this.data.datasets;
let i, ilen;
Function updateElements
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateElements(arcs, start, count, mode) {
const reset = mode === 'reset';
const chart = this.chart;
const chartArea = chart.chartArea;
const opts = chart.options;
Function mergeScaleConfig
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mergeScaleConfig(config, options) {
const chartDefaults = overrides[config.type] || {scales: {}};
const configScales = options.scales || {};
const chartIndexAxis = getIndexAxis(config.type, options);
const scales = Object.create(null);
Function initCanvas
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initCanvas(canvas, aspectRatio) {
const style = canvas.style;
// NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it
// returns null or '' if no explicit value has been set to the canvas attribute.