konvajs/konva

View on GitHub
src/shapes/Transformer.ts

Summary

Maintainability
F
1 wk
Test Coverage

File Transformer.ts has 1151 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Util, Transform } from '../Util';
import { Factory } from '../Factory';
import { Node } from '../Node';
import { Shape } from '../Shape';
import { Rect } from './Rect';
Severity: Major
Found in src/shapes/Transformer.ts - About 2 days to fix

    Function _handleMouseMove has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
    Open

      _handleMouseMove(e) {
        var x, y, newHypotenuse;
        var anchorNode = this.findOne('.' + this._movingAnchorName)!;
        var stage = anchorNode.getStage()!;
    
    
    Severity: Minor
    Found in src/shapes/Transformer.ts - About 1 day 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 _handleMouseMove has 193 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _handleMouseMove(e) {
        var x, y, newHypotenuse;
        var anchorNode = this.findOne('.' + this._movingAnchorName)!;
        var stage = anchorNode.getStage()!;
    
    
    Severity: Major
    Found in src/shapes/Transformer.ts - About 7 hrs to fix

      Function _fitNodesInto has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _fitNodesInto(newAttrs, evt?) {
          var oldAttrs = this._getNodeRect();
      
          const minSize = 1;
      
      
      Severity: Major
      Found in src/shapes/Transformer.ts - About 5 hrs to fix

        Transformer has 37 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class Transformer extends Group {
          _nodes: Array<Node>;
          _movingAnchorName: string | null = null;
          _transforming = false;
          _anchorDragOffset: Vector2d;
        Severity: Minor
        Found in src/shapes/Transformer.ts - About 4 hrs to fix

          Function update has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            update() {
              var attrs = this._getNodeRect();
              this.rotation(Util._getRotation(attrs.rotation));
              var width = attrs.width;
              var height = attrs.height;
          Severity: Major
          Found in src/shapes/Transformer.ts - About 3 hrs to fix

            Function _fitNodesInto has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              _fitNodesInto(newAttrs, evt?) {
                var oldAttrs = this._getNodeRect();
            
                const minSize = 1;
            
            
            Severity: Minor
            Found in src/shapes/Transformer.ts - About 2 hrs 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 __getNodeRect has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              __getNodeRect() {
                var node = this.getNode();
                if (!node) {
                  return {
                    x: -MAX_SAFE_INTEGER,
            Severity: Major
            Found in src/shapes/Transformer.ts - About 2 hrs to fix

              Function _createBack has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _createBack() {
                  var back = new Shape({
                    name: 'back',
                    width: 0,
                    height: 0,
              Severity: Major
              Found in src/shapes/Transformer.ts - About 2 hrs to fix

                Function setNodes has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  setNodes(nodes: Array<Node> = []) {
                    if (this._nodes && this._nodes.length) {
                      this.detach();
                    }
                
                
                Severity: Minor
                Found in src/shapes/Transformer.ts - About 1 hr to fix

                  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 _createAnchor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _createAnchor(name) {
                      var anchor = new Rect({
                        stroke: 'rgb(0, 161, 255)',
                        fill: 'white',
                        strokeWidth: 1,
                  Severity: Minor
                  Found in src/shapes/Transformer.ts - About 1 hr to fix

                    Function _proxyDrag has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _proxyDrag(node: Node) {
                        let lastPos;
                        node.on(`dragstart.${this._getEventNamespace()}`, (e) => {
                          lastPos = node.getAbsolutePosition();
                          // actual dragging of Transformer doesn't make sense
                    Severity: Minor
                    Found in src/shapes/Transformer.ts - About 1 hr 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 too many return statements within this function.
                        Open

                            return 'nwse-resize';
                        Severity: Major
                        Found in src/shapes/Transformer.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return 'ew-resize';
                          Severity: Major
                          Found in src/shapes/Transformer.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return 'ns-resize';
                            Severity: Major
                            Found in src/shapes/Transformer.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return 'nwse-resize';
                              Severity: Major
                              Found in src/shapes/Transformer.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return 'nesw-resize';
                                Severity: Major
                                Found in src/shapes/Transformer.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return 'pointer';
                                  Severity: Major
                                  Found in src/shapes/Transformer.ts - About 30 mins to fix

                                    Function setNodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      setNodes(nodes: Array<Node> = []) {
                                        if (this._nodes && this._nodes.length) {
                                          this.detach();
                                        }
                                    
                                    
                                    Severity: Minor
                                    Found in src/shapes/Transformer.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

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

                                        totalPoints.forEach(function (point) {
                                          var transformed = tr.point(point);
                                          if (minX === undefined) {
                                            minX = maxX = transformed.x;
                                            minY = maxY = transformed.y;
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 1 other location - About 5 hrs to fix
                                    src/Node.ts on lines 512..522

                                    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 153.

                                    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 points = [
                                            { x: box.x, y: box.y },
                                            { x: box.x + box.width, y: box.y },
                                            { x: box.x + box.width, y: box.y + box.height },
                                            { x: box.x, y: box.y + box.height },
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 1 other location - About 4 hrs to fix
                                    src/Node.ts on lines 501..506

                                    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 120.

                                    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 4 locations. Consider refactoring.
                                    Open

                                            var comparePoint = centeredScaling
                                              ? {
                                                  x: this.width() / 2,
                                                  y: this.height() / 2,
                                                }
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 3 other locations - About 2 hrs to fix
                                    src/shapes/Transformer.ts on lines 798..806
                                    src/shapes/Transformer.ts on lines 834..842
                                    src/shapes/Transformer.ts on lines 868..876

                                    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 91.

                                    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 4 locations. Consider refactoring.
                                    Open

                                            var comparePoint = centeredScaling
                                              ? {
                                                  x: this.width() / 2,
                                                  y: this.height() / 2,
                                                }
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 3 other locations - About 2 hrs to fix
                                    src/shapes/Transformer.ts on lines 770..778
                                    src/shapes/Transformer.ts on lines 798..806
                                    src/shapes/Transformer.ts on lines 834..842

                                    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 91.

                                    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 4 locations. Consider refactoring.
                                    Open

                                            var comparePoint = centeredScaling
                                              ? {
                                                  x: this.width() / 2,
                                                  y: this.height() / 2,
                                                }
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 3 other locations - About 2 hrs to fix
                                    src/shapes/Transformer.ts on lines 770..778
                                    src/shapes/Transformer.ts on lines 834..842
                                    src/shapes/Transformer.ts on lines 868..876

                                    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 91.

                                    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 4 locations. Consider refactoring.
                                    Open

                                            var comparePoint = centeredScaling
                                              ? {
                                                  x: this.width() / 2,
                                                  y: this.height() / 2,
                                                }
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 3 other locations - About 2 hrs to fix
                                    src/shapes/Transformer.ts on lines 770..778
                                    src/shapes/Transformer.ts on lines 798..806
                                    src/shapes/Transformer.ts on lines 868..876

                                    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 91.

                                    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

                                        if (typeof window !== 'undefined') {
                                          window.addEventListener('mousemove', this._handleMouseMove);
                                          window.addEventListener('touchmove', this._handleMouseMove);
                                          window.addEventListener('mouseup', this._handleMouseUp, true);
                                          window.addEventListener('touchend', this._handleMouseUp, true);
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 1 other location - About 2 hrs to fix
                                    src/shapes/Transformer.ts on lines 956..961

                                    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 79.

                                    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

                                          if (typeof window !== 'undefined') {
                                            window.removeEventListener('mousemove', this._handleMouseMove);
                                            window.removeEventListener('touchmove', this._handleMouseMove);
                                            window.removeEventListener('mouseup', this._handleMouseUp, true);
                                            window.removeEventListener('touchend', this._handleMouseUp, true);
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 1 other location - About 2 hrs to fix
                                    src/shapes/Transformer.ts on lines 683..688

                                    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 79.

                                    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

                                      const x =
                                        point.x +
                                        (shape.x - point.x) * Math.cos(angleRad) -
                                        (shape.y - point.y) * Math.sin(angleRad);
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 1 other location - About 1 hr to fix
                                    src/shapes/Transformer.ts on lines 174..177

                                    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 67.

                                    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

                                      const y =
                                        point.y +
                                        (shape.x - point.x) * Math.sin(angleRad) +
                                        (shape.y - point.y) * Math.cos(angleRad);
                                    Severity: Major
                                    Found in src/shapes/Transformer.ts and 1 other location - About 1 hr to fix
                                    src/shapes/Transformer.ts on lines 170..173

                                    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 67.

                                    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

                                        if (Util._inRange(newAttrs.width, -this.padding() * 2 - minSize, minSize)) {
                                          this.update();
                                          return;
                                        }
                                    Severity: Minor
                                    Found in src/shapes/Transformer.ts and 1 other location - About 40 mins to fix
                                    src/shapes/Transformer.ts on lines 987..992

                                    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 49.

                                    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

                                        if (
                                          Util._inRange(newAttrs.height, -this.padding() * 2 - minSize, minSize)
                                        ) {
                                          this.update();
                                          return;
                                    Severity: Minor
                                    Found in src/shapes/Transformer.ts and 1 other location - About 40 mins to fix
                                    src/shapes/Transformer.ts on lines 983..986

                                    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 49.

                                    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 2 locations. Consider refactoring.
                                    Open

                                            ctx.rect(
                                              -padding,
                                              -padding,
                                              shape.width() + padding * 2,
                                              shape.height() + padding * 2
                                    Severity: Minor
                                    Found in src/shapes/Transformer.ts and 1 other location - About 40 mins to fix
                                    src/shapes/Transformer.ts on lines 644..649

                                    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 48.

                                    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 2 locations. Consider refactoring.
                                    Open

                                            ctx.rect(
                                              -padding,
                                              -padding,
                                              shape.width() + padding * 2,
                                              shape.height() + padding * 2
                                    Severity: Minor
                                    Found in src/shapes/Transformer.ts and 1 other location - About 40 mins to fix
                                    src/shapes/Transformer.ts on lines 622..627

                                    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 48.

                                    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 width =
                                          this.findOne('.bottom-right')!.x() - this.findOne('.top-left')!.x();
                                    Severity: Minor
                                    Found in src/shapes/Transformer.ts and 1 other location - About 30 mins to fix
                                    src/shapes/Transformer.ts on lines 933..934

                                    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 45.

                                    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 height =
                                          this.findOne('.bottom-right')!.y() - this.findOne('.top-left')!.y();
                                    Severity: Minor
                                    Found in src/shapes/Transformer.ts and 1 other location - About 30 mins to fix
                                    src/shapes/Transformer.ts on lines 930..931

                                    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 45.

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status