lavrton/KineticJS

View on GitHub

Showing 225 of 356 total issues

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

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

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

  _addListeners() {
    // start listeners
    this.tween.onPlay = () => {
      this.anim.start();
    };
Severity: Minor
Found in src/Tween.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 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 __getFillPattern has 31 lines of code (exceeds 25 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 1 hr to fix

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

        static _runFrames() {
          const layerHash = {};
          const animations = this.animations;
          /*
           * loop through all animations and execute animation
      Severity: Minor
      Found in src/Animation.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

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

            _endDragBefore(evt?) {
              const drawNodes: Array<Container> = [];
              DD._dragElements.forEach((elem) => {
                const { node } = elem;
                // we need to find pointer relative to that node
          Severity: Minor
          Found in src/DragAndDrop.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 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 _fill has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _fill(shape) {
                    const hasColor = shape.fill(),
                      fillPriority = shape.getFillPriority();
                
                    // priority fills
                Severity: Minor
                Found in src/Context.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 HSL has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const HSL: Filter = function (imageData) {
                      var data = imageData.data,
                        nPixels = data.length,
                        v = 1,
                        s = Math.pow(2, this.saturation()),
                    Severity: Minor
                    Found in src/filters/HSL.ts - About 1 hr to fix

                      Function _toKonvaCanvas has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        _toKonvaCanvas(config) {
                          config = config || {};
                      
                          config.x = config.x || 0;
                          config.y = config.y || 0;
                      Severity: Minor
                      Found in src/Stage.ts - About 1 hr to fix

                        Function getNumberArrayValidator has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function getNumberArrayValidator() {
                          if (Konva.isUnminified) {
                            return function (val: any, attr: string) {
                              // Retrieve TypedArray constructor as found in MDN (if TypedArray is available)
                              // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#description
                        Severity: Minor
                        Found in src/Validators.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 _handleMouseDown has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _handleMouseDown(e) {
                                // do nothing if we already transforming
                                // that is possible to trigger with multitouch
                                if (this._transforming) {
                                  return;
                            Severity: Minor
                            Found in src/shapes/Transformer.ts - About 1 hr to fix

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

                              export const HSV: Filter = function (imageData) {
                                var data = imageData.data,
                                  nPixels = data.length,
                                  v = Math.pow(2, this.value()),
                                  s = Math.pow(2, this.saturation()),
                              Severity: Minor
                              Found in src/filters/HSV.ts - About 1 hr to fix

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

                                  _prepareToStringify<T>(obj: any): T | null {
                                    var desc;
                                
                                    obj.visitedByCircularReferenceRemoval = true;
                                
                                
                                Severity: Minor
                                Found in src/Util.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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language