nnnick/Chart.js

View on GitHub
src/helpers/helpers.curve.ts

Summary

Maintainability
B
4 hrs
Test Coverage

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);
Severity: Minor
Found in src/helpers/helpers.curve.ts - About 1 hr 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

Function _updateBezierControlPoints has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function _updateBezierControlPoints(
  points: SplinePoint[],
  options,
  area: ChartArea,
  loop: boolean,
Severity: Minor
Found in src/helpers/helpers.curve.ts - About 1 hr to fix

    Function _updateBezierControlPoints has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring.
    Open

    export function _updateBezierControlPoints(
      points: SplinePoint[],
      options,
      area: ChartArea,
      loop: boolean,
    Severity: Minor
    Found in src/helpers/helpers.curve.ts - About 55 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

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

    function monotoneAdjust(points: SplinePoint[], deltaK: number[], mK: number[]) {
      const pointsLen = points.length;
    
      let alphaK: number, betaK: number, tauK: number, squaredMagnitude: number, pointCurrent: OptionalSplinePoint;
      let pointAfter = getPoint(points, 0);
    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

    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

    There are no issues that match your filters.

    Category
    Status