lavrton/KineticJS

View on GitHub

Showing 225 of 354 total issues

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

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

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 (!shouldStop) {
          this._fire(eventType, evt);
    
          // simulate event bubbling
          var 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

        Function remap has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function remap(fromValue, fromMin, fromMax, toMin, toMax) {
        Severity: Minor
        Found in src/filters/Enhance.ts - About 35 mins to fix

          Function addComponentsGetterSetter has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              constructor,
              attr: string,
              components: Array<string>,
              validator?: Function,
              after?: Function
          Severity: Minor
          Found in src/Factory.ts - About 35 mins to fix

            Function addGetterSetter has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              addGetterSetter(constructor, attr, def?, validator?, after?) {
            Severity: Minor
            Found in src/Factory.ts - About 35 mins to fix

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

                _sceneFunc(context: Context) {
                  var width = this.width(),
                    height = this.height(),
                    pointerDirection = this.pointerDirection(),
                    pointerWidth = this.pointerWidth(),
              Severity: Minor
              Found in src/shapes/Label.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 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

              Function __getFillPattern has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                __getFillPattern() {
                  if (this.fillPatternImage()) {
                    var ctx = getDummyContext();
                    const pattern = ctx.createPattern(
                      this.fillPatternImage(),
              Severity: Minor
              Found in src/Shape.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 _stroke has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _stroke(shape) {
                  if (shape.hasHitStroke()) {
                    // ignore strokeScaleEnabled for Text
                    const strokeScaleEnabled = shape.getStrokeScaleEnabled();
                    if (!strokeScaleEnabled) {
              Severity: Minor
              Found in src/Context.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 _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 _descendants has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                private _descendants(fn: (n: Node) => boolean) {
                  let shouldStop = false;
                  const children = this.getChildren();
                  for (const child of children) {
                    shouldStop = fn(child);
              Severity: Minor
              Found in src/Container.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 '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 'pointer';
                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 'ew-resize';
                    Severity: Major
                    Found in src/shapes/Transformer.ts - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language