nnnick/Chart.js

View on GitHub

Showing 245 of 245 total issues

Function capBezierPoints has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
Open

function capBezierPoints(points: SplinePoint[], area: ChartArea) {
  let i, ilen, point, inArea, inAreaPrev;
  let inAreaNext = _isPointInArea(points[0], area);
  for (i = 0, ilen = points.length; i < ilen; ++i) {
    inAreaPrev = inArea;
Severity: Minor
Found in src/helpers/helpers.curve.ts - About 25 mins to fix

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

TODO found
Open

    // TODO: V4, make this private, rename to `_labelStyles`, and combine with `labelPointStyles`
Severity: Minor
Found in src/plugins/plugin.tooltip.js by fixme

TODO found
Open

      ctx.lineWidth = isObject(labelColor.borderWidth) ? Math.max(...Object.values(labelColor.borderWidth)) : (labelColor.borderWidth || 1); // TODO, v4 remove fallback
Severity: Minor
Found in src/plugins/plugin.tooltip.js by fixme

TODO found
Open

      // TODO: It is not optimal to always parse the old data
Severity: Minor
Found in src/core/core.datasetController.js by fixme

TODO found
Open

// TODO: use elements.ArcElement instead
Severity
Category
Status
Source
Language