lavrton/KineticJS

View on GitHub

Showing 225 of 354 total issues

Function _getProjectionToSegment has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  _getProjectionToSegment(x1, y1, x2, y2, x3, y3) {
Severity: Minor
Found in src/Util.ts - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (shouldHandleEllipsis) {
                  this._tryToAddEllipsisToLastLine();
                  /*
                   * stop wrapping if wrapping is disabled or if adding
                   * one more line would overflow the fixed height
    Severity: Major
    Found in src/shapes/Text.ts - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

            if (keepProportion) {
              var comparePoint = centeredScaling
                ? {
                    x: this.width() / 2,
                    y: this.height() / 2,
      Severity: Major
      Found in src/shapes/Transformer.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (substrWidth <= maxWidth) {
                      low = mid + 1;
                      match = substr;
                      matchWidth = substrWidth;
                    } else {
        Severity: Major
        Found in src/shapes/Text.ts - About 45 mins to fix

          Function decompose has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            decompose() {
              var a = this.m[0];
              var b = this.m[1];
              var c = this.m[2];
              var d = this.m[3];
          Severity: Minor
          Found in src/Util.ts - About 45 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

          Avoid deeply nested control flow statements.
          Open

                    if (y >= height) {
                      continue;
                    }
          Severity: Major
          Found in src/filters/Pixelate.ts - About 45 mins to fix

            Function ElasticEaseOut has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              ElasticEaseOut(t, b, c, d, a, p) {
            Severity: Minor
            Found in src/Tween.ts - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {
                          var srcOff = scy * sw + scx;
                          var wt = weights[cy * side + cx];
              
                          a += mask[srcOff] * wt;
              Severity: Major
              Found in src/filters/Mask.ts - About 45 mins to fix

                Function _sceneFunc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  _sceneFunc(context: Context) {
                    context.setAttr('font', this._getContextFont());
                    context.setAttr('textBaseline', this.textBaseline());
                    context.setAttr('textAlign', 'left');
                    context.save();
                Severity: Minor
                Found in src/shapes/TextPath.ts - About 45 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

                Avoid deeply nested control flow statements.
                Open

                            if (line.length > 0) {
                              // Check if the remaining text would fit on one line
                              lineWidth = this._getTextWidth(line);
                              if (lineWidth <= maxWidth) {
                                // if it does, add the line and break out of the loop
                Severity: Major
                Found in src/shapes/Text.ts - About 45 mins to fix

                  Function ElasticEaseIn has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    ElasticEaseIn(t, b, c, d, a, p) {
                  Severity: Minor
                  Found in src/Tween.ts - About 45 mins to fix

                    Function ElasticEaseInOut has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      ElasticEaseInOut(t, b, c, d, a, p) {
                    Severity: Minor
                    Found in src/Tween.ts - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (n % 2 === 0) {
                                    newVal.push((start[n] || 0) + diff[n] * i);
                                  } else {
                                    newVal.push(
                                      'rgba(' +
                      Severity: Major
                      Found in src/Tween.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                  if (y >= height) {
                                    continue;
                                  }
                        Severity: Major
                        Found in src/filters/Pixelate.ts - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {
                                      var srcOff = scy * sw + scx;
                                      var wt = weights[cy * side + cx];
                          
                                      a += mask[srcOff] * wt;
                          Severity: Major
                          Found in src/filters/Mask.ts - About 45 mins to fix

                            Function getPointOnLine has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX?, fromY?) {
                                if (fromX === undefined) {
                                  fromX = P1x;
                                }
                                if (fromY === undefined) {
                            Severity: Minor
                            Found in src/shapes/Path.ts - About 45 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

                            Avoid deeply nested control flow statements.
                            Open

                                          for (var idx = ca.length - 2; idx >= 0; idx--) {
                                            if (ca[idx].command === 'M') {
                                              cpx = ca[idx].points[0] + dx;
                                              cpy = ca[idx].points[1] + dy;
                                              break;
                            Severity: Major
                            Found in src/shapes/Path.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          if (rounded) {
                                            args = args.map((a) =>
                                              typeof a === 'number' ? Math.floor(a) : a
                                            );
                                          }
                              Severity: Major
                              Found in src/Context.ts - About 45 mins to fix

                                Function drawHit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  drawHit(can?: HitCanvas, top?: Node, skipDragCheck = false) {
                                    if (!this.shouldDrawHit(top, skipDragCheck)) {
                                      return this;
                                    }
                                
                                
                                Severity: Minor
                                Found in src/Shape.ts - About 45 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 getDerivative has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const getDerivative = (derivative: number, t: number, vs: number[]): number => {
                                  // the derivative of any 't'-less function is zero.
                                  const n = vs.length - 1;
                                  let _vs;
                                  let value;
                                Severity: Minor
                                Found in src/BezierFunctions.ts - About 45 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

                                Severity
                                Category
                                Status
                                Source
                                Language