lavrton/KineticJS

View on GitHub

Showing 225 of 354 total issues

Function getPointAtLengthOfDataArray has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static getPointAtLengthOfDataArray(length: number, dataArray) {
    var point,
      i = 0,
      ii = dataArray.length;

Severity: Major
Found in src/shapes/Path.ts - About 3 hrs to fix

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

      _sceneFunc(context: Context) {
        var width = this.width(),
          height = this.height(),
          pointerDirection = this.pointerDirection(),
          pointerWidth = this.pointerWidth(),
    Severity: Major
    Found in src/shapes/Label.ts - About 3 hrs to fix

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

        _sceneFunc(ctx: Context) {
          super._sceneFunc(ctx);
          var PI2 = Math.PI * 2;
          var points = this.points();
      
      
      Severity: Major
      Found in src/shapes/Arrow.ts - About 2 hrs to fix

        File TextPath.ts has 290 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Util } from '../Util';
        import { Factory } from '../Factory';
        import { Context } from '../Context';
        import { Shape, ShapeConfig } from '../Shape';
        import { Path } from './Path';
        Severity: Minor
        Found in src/shapes/TextPath.ts - About 2 hrs to fix

          Function calcLength has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static calcLength(x, y, cmd, points) {
              var len, p1, p2, t;
              var path = Path;
          
              switch (cmd) {
          Severity: Major
          Found in src/shapes/Path.ts - About 2 hrs to fix

            Function getTrace has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              getTrace(relaxed?: boolean, rounded?: boolean) {
                var traceArr = this.traceArr,
                  len = traceArr.length,
                  str = '',
                  n,
            Severity: Minor
            Found in src/Context.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 Pixelate has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const Pixelate: Filter = function (imageData) {
              var pixelSize = Math.ceil(this.pixelSize()),
                width = imageData.width,
                height = imageData.height,
                x,
            Severity: Major
            Found in src/filters/Pixelate.ts - About 2 hrs to fix

              Function _addAttr has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _addAttr(key, end) {
                  var node = this.node,
                    nodeId = node._id,
                    start,
                    diff,
              Severity: Major
              Found in src/Tween.ts - About 2 hrs to fix

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

                  _setTextData() {
                    const { width, height } = this._getTextSize(this.attrs.text);
                    this.textWidth = width;
                    this.textHeight = height;
                    this.glyphInfo = [];
                Severity: Major
                Found in src/shapes/TextPath.ts - About 2 hrs to fix

                  Function Kaleidoscope has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const Kaleidoscope: Filter = function (imageData) {
                    var xSize = imageData.width,
                      ySize = imageData.height;
                  
                    var x, y, xoff, i, r, g, b, a, srcPos, dstPos;
                  Severity: Major
                  Found in src/filters/Kaleidoscope.ts - About 2 hrs to fix

                    Function _hslColorToRGBA has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _hslColorToRGBA(str: string) {
                        // Check hsl() format
                        if (/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(str)) {
                          // Extract h, s, l
                          const [_, ...hsl] = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(str)!;
                    Severity: Minor
                    Found in src/Util.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 _sceneFunc has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _sceneFunc(context: Context) {
                        var points = this.points(),
                          length = points.length,
                          tension = this.tension(),
                          closed = this.closed(),
                    Severity: Minor
                    Found in src/shapes/Line.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 _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

                    File Blur.ts has 274 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { Factory } from '../Factory';
                    import { Node, Filter } from '../Node';
                    import { getNumberValidator } from '../Validators';
                    /*
                     the Gauss filter
                    Severity: Minor
                    Found in src/filters/Blur.ts - About 2 hrs to fix

                      Function getClientRect has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        getClientRect(
                          config: {
                            skipTransform?: boolean;
                            skipShadow?: boolean;
                            skipStroke?: boolean;
                      Severity: Major
                      Found in src/Container.ts - About 2 hrs to fix

                        Function _pointermove has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _pointermove(evt: TouchEvent | MouseEvent | PointerEvent) {
                            const events = getEventsMap(evt.type);
                            const eventType = getEventType(evt.type);
                            if (!events) {
                              return;
                        Severity: Major
                        Found in src/Stage.ts - About 2 hrs to fix

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

                            _sceneFunc(context: Context) {
                              var points = this.points(),
                                length = points.length,
                                tension = this.tension(),
                                closed = this.closed(),
                          Severity: Major
                          Found in src/shapes/Line.ts - About 2 hrs to fix

                            Function dilateMask has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function dilateMask(mask, sw, sh) {
                              var weights = [1, 1, 1, 1, 1, 1, 1, 1, 1];
                              var side = Math.round(Math.sqrt(weights.length));
                              var halfSide = Math.floor(side / 2);
                            
                            
                            Severity: Minor
                            Found in src/filters/Mask.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 erodeMask has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function erodeMask(mask, sw, sh) {
                              var weights = [1, 1, 1, 1, 0, 1, 1, 1, 1];
                              var side = Math.round(Math.sqrt(weights.length));
                              var halfSide = Math.floor(side / 2);
                            
                            
                            Severity: Minor
                            Found in src/filters/Mask.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 drawScene has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              drawScene(can?: SceneCanvas, top?: Node, bufferCanvas?: SceneCanvas) {
                                // basically there are 3 drawing modes
                                // 1 - simple drawing when nothing is cached.
                                // 2 - when we are caching current
                                // 3 - when node is cached and we need to draw it into layer
                            Severity: Major
                            Found in src/Shape.ts - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language