konvajs/konva

View on GitHub
src/Node.ts

Summary

Maintainability
F
2 wks
Test Coverage

File Node.ts has 1787 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Util, Transform } from './Util';
import { Factory } from './Factory';
import { SceneCanvas, HitCanvas, Canvas } from './Canvas';
import { Konva } from './Global';
import { Container } from './Container';
Severity: Major
Found in src/Node.ts - About 4 days to fix

    Node has 111 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export abstract class Node<Config extends NodeConfig = NodeConfig> {
      _id = idCounter++;
      eventListeners: {
        [index: string]: Array<{ name: string; handler: Function }>;
      } = {};
    Severity: Major
    Found in src/Node.ts - About 2 days to fix

      Function cache has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        cache(config?: {
          x?: number;
          y?: number;
          width?: number;
          height?: number;
      Severity: Major
      Found in src/Node.ts - About 3 hrs to fix

        Function _fireAndBubble has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          _fireAndBubble(eventType, evt, compareShape?) {
            if (evt && this.nodeType === SHAPE) {
              evt.target = this;
            }
        
        
        Severity: Minor
        Found in src/Node.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 _getCachedSceneCanvas has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _getCachedSceneCanvas() {
            var filters = this.filters(),
              cachedCanvas = this._getCanvasCache(),
              sceneCanvas = cachedCanvas.scene,
              filterCanvas = cachedCanvas.filter,
        Severity: Major
        Found in src/Node.ts - About 2 hrs to fix

          Function _isMatch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            _isMatch(selector: string | Function) {
              if (!selector) {
                return false;
              }
              if (typeof selector === 'function') {
          Severity: Minor
          Found in src/Node.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 off has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            off(evtStr?: string, callback?: Function) {
              var events = (evtStr || '').split(SPACE),
                len = events.length,
                n,
                t,
          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 _getCachedSceneCanvas has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            _getCachedSceneCanvas() {
              var filters = this.filters(),
                cachedCanvas = this._getCanvasCache(),
                sceneCanvas = cachedCanvas.scene,
                filterCanvas = cachedCanvas.filter,
          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 _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 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 _getAbsoluteTransform has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _getAbsoluteTransform(top?: Node) {
                var at: Transform;
                // we we need position relative to an ancestor, we will iterate for all
                if (top) {
                  at = new Transform();
            Severity: Minor
            Found in src/Node.ts - About 1 hr to fix

              Function clone has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                clone(obj?: any) {
                  // instantiate new node
                  var attrs = Util.cloneObject(this.attrs),
                    key,
                    allListeners,
              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 _toKonvaCanvas has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _toKonvaCanvas(config) {
                  config = config || {};
              
                  var box = this.getClientRect();
              
              
              Severity: Minor
              Found in src/Node.ts - About 1 hr to fix

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

                  toObject() {
                    var attrs = this.getAttrs() as any,
                      key,
                      val,
                      getter,
                Severity: Minor
                Found in src/Node.ts - About 1 hr to fix

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

                    off(evtStr?: string, callback?: Function) {
                      var events = (evtStr || '').split(SPACE),
                        len = events.length,
                        n,
                        t,
                  Severity: Minor
                  Found in src/Node.ts - About 1 hr to fix

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

                      _fireAndBubble(eventType, evt, compareShape?) {
                        if (evt && this.nodeType === SHAPE) {
                          evt.target = this;
                        }
                    
                    
                    Severity: Minor
                    Found in src/Node.ts - About 1 hr to fix

                      Function getAbsoluteZIndex has 29 lines of code (exceeds 25 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

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

                          _transformedRect(rect: IRect, top?: Node | null) {
                            var points = [
                              { x: rect.x, y: rect.y },
                              { x: rect.x + rect.width, y: rect.y },
                              { x: rect.x + rect.width, y: rect.y + rect.height },
                        Severity: Minor
                        Found in src/Node.ts - About 1 hr to fix

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

                            _getTransform(): Transform {
                              var m: Transform = this._cache.get(TRANSFORM) || new Transform();
                              m.reset();
                          
                              // I was trying to use attributes directly here
                          Severity: Minor
                          Found in src/Node.ts - About 1 hr to fix

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

                                _dragChange() {
                                  if (this.attrs.draggable) {
                                    this._listenDrag();
                                  } else {
                                    // remove event listeners
                              Severity: Minor
                              Found in src/Node.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 _getAbsoluteTransform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                _getAbsoluteTransform(top?: Node) {
                                  var at: Transform;
                                  // we we need position relative to an ancestor, we will iterate for all
                                  if (top) {
                                    at = new Transform();
                              Severity: Minor
                              Found in src/Node.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

                              Consider simplifying this complex logical expression.
                              Open

                                    if (
                                      ((evt && !evt.cancelBubble) || !evt) &&
                                      this.parent &&
                                      this.parent.isListening() &&
                                      !stopBubble
                              Severity: Major
                              Found in src/Node.ts - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                      if (
                                        (evtName !== 'konva' || name === 'konva') &&
                                        (!name || evtName === name) &&
                                        (!callback || callback === handler)
                                      ) {
                                Severity: Major
                                Found in src/Node.ts - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                      if (!shouldStop) {
                                        this._fire(eventType, evt);
                                  
                                        // simulate event bubbling
                                        var stopBubble =
                                  Severity: Major
                                  Found in src/Node.ts - About 40 mins to fix

                                    Function _setDragPosition has a Cognitive Complexity of 7 (exceeds 5 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 35 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 _getTransform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      _getTransform(): Transform {
                                        var m: Transform = this._cache.get(TRANSFORM) || new Transform();
                                        m.reset();
                                    
                                        // I was trying to use attributes directly here
                                    Severity: Minor
                                    Found in src/Node.ts - About 35 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 _fire has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      _fire(eventType, evt) {
                                        evt = evt || {};
                                        evt.currentTarget = this;
                                        evt.type = eventType;
                                    
                                    
                                    Severity: Minor
                                    Found in src/Node.ts - About 35 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 toObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      toObject() {
                                        var attrs = this.getAttrs() as any,
                                          key,
                                          val,
                                          getter,
                                    Severity: Minor
                                    Found in src/Node.ts - About 35 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 too many return statements within this function.
                                    Open

                                        return false;
                                    Severity: Major
                                    Found in src/Node.ts - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return true;
                                      Severity: Major
                                      Found in src/Node.ts - About 30 mins to fix

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

                                          on<K extends keyof NodeEventMap>(
                                            evtStr: K,
                                            handler: KonvaEventListener<this, NodeEventMap[K]>
                                          ) {
                                            this._cache && this._cache.delete(ALL_LISTENERS);
                                        Severity: Minor
                                        Found in src/Node.ts - About 25 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

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

                                          findAncestors(
                                            selector: string | Function,
                                            includeSelf?: boolean,
                                            stopNode?: Node
                                          ) {
                                        Severity: Minor
                                        Found in src/Node.ts - About 25 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

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

                                          _toKonvaCanvas(config) {
                                            config = config || {};
                                        
                                            var box = this.getClientRect();
                                        
                                        
                                        Severity: Minor
                                        Found in src/Node.ts - About 25 mins to fix

                                        Cognitive Complexity

                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                        A method's cognitive complexity is based on a few simple rules:

                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                        • Code is considered more complex for each "break in the linear flow of the code"
                                        • Code is considered more complex when "flow breaking structures are nested"

                                        Further reading

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

                                          _setAttr(key, val) {
                                            var oldVal = this.attrs[key];
                                            if (oldVal === val && !Util.isObject(val)) {
                                              return;
                                            }
                                        Severity: Minor
                                        Found in src/Node.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

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

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

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

                                          _isVisible(relativeTo?: Node): boolean {
                                            const visible = this.visible();
                                            if (!visible) {
                                              return false;
                                            }
                                        Severity: Major
                                        Found in src/Node.ts and 1 other location - About 2 hrs to fix
                                        src/Node.ts on lines 974..985

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

                                        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

                                          _isListening(relativeTo?: Node): boolean {
                                            const listening = this.listening();
                                            if (!listening) {
                                              return false;
                                            }
                                        Severity: Major
                                        Found in src/Node.ts and 1 other location - About 2 hrs to fix
                                        src/Node.ts on lines 1003..1014

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

                                        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 (index > 0) {
                                              this.parent.children.splice(index, 1);
                                              this.parent.children.splice(index - 1, 0, this);
                                              this.parent._setChildrenIndices();
                                              return true;
                                        Severity: Major
                                        Found in src/Node.ts and 1 other location - About 1 hr to fix
                                        src/Node.ts on lines 1382..1387

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

                                        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 (index < len - 1) {
                                              this.parent.children.splice(index, 1);
                                              this.parent.children.splice(index + 1, 0, this);
                                              this.parent._setChildrenIndices();
                                              return true;
                                        Severity: Major
                                        Found in src/Node.ts and 1 other location - About 1 hr to fix
                                        src/Node.ts on lines 1402..1407

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

                                        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 (index > 0) {
                                              this.parent.children.splice(index, 1);
                                              this.parent.children.unshift(this);
                                              this.parent._setChildrenIndices();
                                              return true;
                                        Severity: Major
                                        Found in src/Node.ts and 1 other location - About 1 hr to fix
                                        src/Node.ts on lines 1361..1366

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

                                        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 (index < len - 1) {
                                              this.parent.children.splice(index, 1);
                                              this.parent.children.push(this);
                                              this.parent._setChildrenIndices();
                                              return true;
                                        Severity: Major
                                        Found in src/Node.ts and 1 other location - About 1 hr to fix
                                        src/Node.ts on lines 1422..1427

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

                                        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 (selfListeners) {
                                              for (var i = 0; i < selfListeners.length; i++) {
                                                selfListeners[i].handler.call(this, evt);
                                              }
                                            }
                                        Severity: Minor
                                        Found in src/Node.ts and 1 other location - About 50 mins to fix
                                        src/Node.ts on lines 2381..2385

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

                                        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 (topListeners) {
                                              for (var i = 0; i < topListeners.length; i++) {
                                                topListeners[i].handler.call(this, evt);
                                              }
                                            }
                                        Severity: Minor
                                        Found in src/Node.ts and 1 other location - About 50 mins to fix
                                        src/Node.ts on lines 2390..2394

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

                                        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