lavrton/KineticJS

View on GitHub

Showing 225 of 354 total issues

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

  _sceneFunc(context: Context) {
    var textArr = this.textArr,
      textArrLen = textArr.length;

    if (!this.text()) {
Severity: Minor
Found in src/shapes/Text.ts - About 6 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

Stage has 42 functions (exceeds 20 allowed). Consider refactoring.
Open

export class Stage extends Container<Layer> {
  content: HTMLDivElement;
  pointerPos: Vector2d | null;
  _pointerPositions: (Vector2d & { id?: number })[] = [];
  _changedPointerPositions: (Vector2d & { id: number })[] = [];
Severity: Minor
Found in src/Stage.ts - About 5 hrs to fix

    Function filterGaussBlurRGBA has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    function filterGaussBlurRGBA(imageData, radius) {
      var pixels = imageData.data,
        width = imageData.width,
        height = imageData.height;
    
    
    Severity: Minor
    Found in src/filters/Blur.ts - About 5 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 Pixelate has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    export const Pixelate: Filter = function (imageData) {
      var pixelSize = Math.ceil(this.pixelSize()),
        width = imageData.width,
        height = imageData.height,
        x,
    Severity: Minor
    Found in src/filters/Pixelate.ts - About 5 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 _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

      File Container.ts has 374 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Factory } from './Factory';
      import { Node, NodeConfig } from './Node';
      import { getNumberValidator } from './Validators';
      
      import { GetSet, IRect } from './types';
      Severity: Minor
      Found in src/Container.ts - About 5 hrs to fix

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

          _sceneFunc(context: Context) {
            var textArr = this.textArr,
              textArrLen = textArr.length;
        
            if (!this.text()) {
        Severity: Major
        Found in src/shapes/Text.ts - About 4 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

            Layer has 35 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export class Layer extends Container<Group | Shape> {
              canvas = new SceneCanvas();
              hitCanvas = new HitCanvas({
                pixelRatio: 1,
              });
            Severity: Minor
            Found in src/Layer.ts - About 4 hrs to fix

              File Layer.ts has 344 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { Util } from './Util';
              import { Container, ContainerConfig } from './Container';
              import { Node } from './Node';
              import { Factory } from './Factory';
              import { SceneCanvas, HitCanvas } from './Canvas';
              Severity: Minor
              Found in src/Layer.ts - About 4 hrs to fix

                Function Emboss has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const Emboss: Filter = function (imageData) {
                  // pixastic strength is between 0 and 10.  I want it between 0 and 1
                  // pixastic greyLevel is between 0 and 255.  I want it between 0 and 1.  Also,
                  // a max value of greyLevel yields a white emboss, and the min value yields a black
                  // emboss.  Therefore, I changed greyLevel to whiteLevel
                Severity: Major
                Found in src/filters/Emboss.ts - About 4 hrs to fix

                  Function _setTextData has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _setTextData() {
                      var lines = this.text().split('\n'),
                        fontSize = +this.fontSize(),
                        textWidth = 0,
                        lineHeightPx = this.lineHeight() * fontSize,
                  Severity: Major
                  Found in src/shapes/Text.ts - About 4 hrs to fix

                    Shape has 31 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export class Shape<
                      Config extends ShapeConfig = ShapeConfig
                    > extends Node<Config> {
                      _centroid: boolean;
                      colorKey: string;
                    Severity: Minor
                    Found in src/Shape.ts - About 3 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 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 _addAttr has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                          Open

                            _addAttr(key, end) {
                              var node = this.node,
                                nodeId = node._id,
                                start,
                                diff,
                          Severity: Minor
                          Found in src/Tween.ts - About 3 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 _tweenFunc has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                          Open

                            _tweenFunc(i) {
                              var node = this.node,
                                attrs = Tween.attrs[node._id][this._id],
                                key,
                                attr,
                          Severity: Minor
                          Found in src/Tween.ts - About 3 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 Enhance has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const Enhance: Filter = function (imageData) {
                            var data = imageData.data,
                              nSubPixels = data.length,
                              rMin = data[0],
                              rMax = rMin,
                          Severity: Major
                          Found in src/filters/Enhance.ts - About 3 hrs to fix

                            Function _pointerup has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _pointerup(evt) {
                                const events = getEventsMap(evt.type);
                                const eventType = getEventType(evt.type);
                            
                                if (!events) {
                            Severity: Major
                            Found in src/Stage.ts - About 3 hrs to fix

                              Function getSelfRect has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                getSelfRect() {
                                  var points: Array<number> = [];
                                  this.dataArray.forEach(function (data) {
                                    if (data.command === 'A') {
                                      // Approximates by breaking curve into line segments
                              Severity: Major
                              Found in src/shapes/Path.ts - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language