konvajs/konva

View on GitHub

Showing 359 of 359 total issues

Function _sceneFunc has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _sceneFunc(context: Context) {
    const width = this.getWidth();
    const height = this.getHeight();
    const cornerRadius = this.cornerRadius();
    const image = this.attrs.image;
Severity: Minor
Found in src/shapes/Image.ts - About 1 hr to fix

    Function _getTensionPointsClosed has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _getTensionPointsClosed() {
        var p = this.points(),
          len = p.length,
          tension = this.tension(),
          firstControlPoints = getControlPoints(
    Severity: Minor
    Found in src/shapes/Line.ts - About 1 hr to fix

      Function _pointerdown has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _pointerdown(evt: TouchEvent | MouseEvent | PointerEvent) {
          const events = getEventsMap(evt.type);
          const eventType = getEventType(evt.type);
      
          if (!events) {
      Severity: Minor
      Found in src/Stage.ts - About 1 hr to fix

        Function _enableTrace has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _enableTrace() {
            var that = this,
              len = CONTEXT_METHODS.length,
              origSetter = this.setAttr,
              n,
        Severity: Minor
        Found in src/Context.ts - About 1 hr to fix

          Function drawHitFromCache has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            drawHitFromCache(alphaThreshold = 0) {
              var cachedCanvas = this._getCanvasCache(),
                sceneCanvas = this._getCachedSceneCanvas(),
                hitCanvas = cachedCanvas.hit,
                hitContext = hitCanvas.getContext(),
          Severity: Minor
          Found in src/Shape.ts - About 1 hr to fix

            Function setPointersPositions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              setPointersPositions(evt) {
                var contentPosition = this._getContentPosition(),
                  x: number | null = null,
                  y: number | null = null;
                evt = evt ? evt : window.event;
            Severity: Minor
            Found in src/Stage.ts - About 1 hr to fix

              Function _isMatch has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _isMatch(selector: string | Function) {
                  if (!selector) {
                    return false;
                  }
                  if (typeof selector === 'function') {
              Severity: Minor
              Found in src/Node.ts - About 1 hr to fix

                Function getTrace has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  getTrace(relaxed?: boolean, rounded?: boolean) {
                    var traceArr = this.traceArr,
                      len = traceArr.length,
                      str = '',
                      n,
                Severity: Minor
                Found in src/Context.ts - About 1 hr to fix

                  Function Kaleidoscope has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const Kaleidoscope: Filter = function (imageData) {
                    var xSize = imageData.width,
                      ySize = imageData.height;
                  
                    var x, y, xoff, i, r, g, b, a, srcPos, dstPos;
                  Severity: Minor
                  Found in src/filters/Kaleidoscope.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 calcLength has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    static calcLength(x, y, cmd, points) {
                      var len, p1, p2, t;
                      var path = Path;
                  
                      switch (cmd) {
                  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 getCursor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getCursor(anchorName, rad, rotateCursor) {
                    if (anchorName === 'rotater') {
                      return rotateCursor;
                    }
                  
                  
                  Severity: Minor
                  Found in src/shapes/Transformer.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 Solarize has a Cognitive Complexity of 12 (exceeds 5 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

                  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 _stroke has a Cognitive Complexity of 12 (exceeds 5 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

                  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 getAbsoluteZIndex has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    getAbsoluteZIndex() {
                      var depth = this.getDepth(),
                        that = this,
                        index = 0,
                        nodes,
                  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 getSelfRect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    getSelfRect() {
                      if (!this.glyphInfo.length) {
                        return {
                          x: 0,
                          y: 0,
                  Severity: Minor
                  Found in src/shapes/TextPath.ts - About 1 hr to fix

                    Function _sceneFunc has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _sceneFunc(context: Context) {
                        var anim = this.animation(),
                          index = this.frameIndex(),
                          ix4 = index * 4,
                          set = this.animations()[anim],
                    Severity: Minor
                    Found in src/shapes/Sprite.ts - About 1 hr to fix

                      Function decompose has 35 lines of code (exceeds 25 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 1 hr to fix

                        Identical blocks of code found in 3 locations. Consider refactoring.
                        Open

                              for (var n = 0; n < colorStops.length; n += 2) {
                                grd.addColorStop(colorStops[n] as number, colorStops[n + 1] as string);
                              }
                        Severity: Major
                        Found in src/Context.ts and 2 other locations - About 1 hr to fix
                        src/Shape.ts on lines 306..308
                        src/Shape.ts on lines 333..335

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 63.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 3 locations. Consider refactoring.
                        Open

                              for (var n = 0; n < colorStops.length; n += 2) {
                                grd.addColorStop(colorStops[n] as number, colorStops[n + 1] as string);
                              }
                        Severity: Major
                        Found in src/Shape.ts and 2 other locations - About 1 hr to fix
                        src/Context.ts on lines 884..886
                        src/Shape.ts on lines 333..335

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 63.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            var dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4];
                        Severity: Major
                        Found in src/Util.ts and 1 other location - About 1 hr to fix
                        src/Util.ts on lines 170..170

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 63.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language