lavrton/KineticJS

View on GitHub

Showing 225 of 354 total issues

Function _setDragPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _setDragPosition(evt, elem) {
    // const pointers = this.getStage().getPointersPositions();
    // const pos = pointers.find(p => p.id === this._dragEventId);
    const pos = this.getStage()!._getPointerById(elem.pointerId);

Severity: Minor
Found in src/Node.ts - About 1 hr to fix

    Function _stroke has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _stroke(shape) {
        var dash = shape.dash(),
          // ignore strokeScaleEnabled for Text
          strokeScaleEnabled = shape.getStrokeScaleEnabled();
    
    
    Severity: Minor
    Found in src/Context.ts - About 1 hr to fix

      Function convertEndpointToCenterParameterization has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        static convertEndpointToCenterParameterization(
          x1,
          y1,
          x2,
          y2,
      Severity: Minor
      Found in src/shapes/Path.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 _off has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        _off(type, name?, callback?) {
          var evtListeners = this.eventListeners[type],
            i,
            evtName,
            handler;
      Severity: Minor
      Found in src/Node.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 t2length has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export const t2length = (
        length: number,
        totalLength: number,
        func: (t: number) => number
      ): number => {
      Severity: Minor
      Found in src/BezierFunctions.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 _prepareArrayForTween has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _prepareArrayForTween(startArray, endArray, isClosed) {
          var n,
            start: Vector2d[] = [],
            end: Vector2d[] = [];
          if (startArray.length > endArray.length) {
      Severity: Minor
      Found in src/Util.ts - About 1 hr to fix

        Function Solarize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Solarize: Filter = function (imageData) {
          var data = imageData.data,
            w = imageData.width,
            h = imageData.height,
            w4 = w * 4,
        Severity: Minor
        Found in src/filters/Solarize.ts - About 1 hr to fix

          Function getIntersection has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getIntersection(pos: Vector2d) {
              if (!this.isListening() || !this.isVisible()) {
                return null;
              }
              // in some cases antialiased area may be bigger than 1px
          Severity: Minor
          Found in src/Layer.ts - About 1 hr to fix

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

            export const getQuadraticArcLength = (
              xs: number[],
              ys: number[],
              t: number
            ) => {
            Severity: Minor
            Found in src/BezierFunctions.ts - About 1 hr to fix

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

              export const t2length = (
                length: number,
                totalLength: number,
                func: (t: number) => number
              ): number => {
              Severity: Minor
              Found in src/BezierFunctions.ts - About 1 hr to fix

                Function setTime has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  setTime(t) {
                    if (t > this.duration) {
                      if (this.yoyo) {
                        this._time = this.duration;
                        this.reverse();
                Severity: Minor
                Found in src/Tween.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 _sceneFunc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  _sceneFunc(ctx: Context) {
                    super._sceneFunc(ctx);
                    var PI2 = Math.PI * 2;
                    var points = this.points();
                
                
                Severity: Minor
                Found in src/shapes/Arrow.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 _fill has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  _fill(shape) {
                    const hasColor = shape.fill(),
                      fillPriority = shape.getFillPriority();
                
                    // priority fills
                Severity: Minor
                Found in src/Context.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 _drawChildren has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  _drawChildren(drawMethod, canvas, top, bufferCanvas?) {
                    var context = canvas && canvas.getContext(),
                      clipWidth = this.clipWidth(),
                      clipHeight = this.clipHeight(),
                      clipFunc = this.clipFunc(),
                Severity: Minor
                Found in src/Container.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 cache has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  cache(config?: {
                    x?: number;
                    y?: number;
                    width?: number;
                    height?: number;
                Severity: Minor
                Found in src/Node.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 getControlPoints has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function getControlPoints(x0, y0, x1, y1, x2, y2, t) {
                Severity: Major
                Found in src/shapes/Line.ts - About 50 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 _rgbaColorToRGBA has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _rgbaColorToRGBA(str: string) {
                        if (str.indexOf('rgba(') === 0) {
                          str = str.match(/rgba\(([^)]+)\)/)![1]!;
                          var parts = str.split(/ *, */).map((n, index) => {
                            if (n.slice(-1) === '%') {
                    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

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

                    function backgroundMask(idata, threshold) {
                      var rgbv_no = pixelAt(idata, 0, 0);
                      var rgbv_ne = pixelAt(idata, idata.width - 1, 0);
                      var rgbv_so = pixelAt(idata, 0, idata.height - 1);
                      var rgbv_se = pixelAt(idata, idata.width - 1, idata.height - 1);
                    Severity: Minor
                    Found in src/filters/Mask.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 (wrapAtWord) {
                                  // try to find a space or dash where wrapping could be done
                                  var wrapIndex;
                                  var nextChar = line[match.length];
                                  var nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
                    Severity: Major
                    Found in src/shapes/Text.ts - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language