spritejs/spritejs

View on GitHub

Showing 34 of 126 total issues

Avoid deeply nested control flow statements.
Open

            if(event.identifier === pointer.identifier) {
              originalTouch = pointer;
              break;
            }
Severity: Major
Found in src/node/spritesvg.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if(matched) {
                  let [, method, value] = matched;
                  if(method === 'rotate') value = Math.PI * parseFloat(value) / 180;
                  else value = value.trim().split(/[\s,]+/).map(v => toNumber(v));
                  if(method === 'matrix') {
    Severity: Major
    Found in src/attribute/node.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  for(let j = 0; j < offscreens.length; j++) {
                    const ol = offscreens[j];
                    ol.render();
                    drawImage(layer, ol);
                  }
      Severity: Major
      Found in src/node/scene.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

              if(unit === 'vmax') {
                size *= Math.max(width, height) / 100;
              } else {
                size *= Math.min(width, height) / 100;
              }
        Severity: Major
        Found in src/utils/attribute_value.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                  if(width == null) w = img.width / ratio;
          Severity: Major
          Found in src/node/sprite.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      } else if(layer.prepareRender) {
                        layer.render();
                      }
            Severity: Major
            Found in src/node/scene.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                if(ancestor instanceof Node && !enteredTargets.has(ancestor)) {
                                  enteredTargets.add(ancestor);
                                  ancestor.dispatchEvent(enterEvent);
                                }
              Severity: Major
              Found in src/node/scene.js - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                    if(value != null && value !== 'none' && value !== 'visible' && value !== 'visibleFill' && value !== 'visibleStroke' && value !== 'all') {
                      throw new TypeError('Invalid pointerEvents type.');
                    }
                Severity: Major
                Found in src/attribute/node.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                      if(m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1 && m[4] === 0 && m[5] === 0) {
                        return null;
                      }
                  Severity: Major
                  Found in src/node/layer.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if(typeof document !== 'undefined'
                              && document.documentElement
                              && document.documentElement.contains
                              && target.layer
                              && target.layer.canvas
                    Severity: Major
                    Found in src/animation/index.js - About 40 mins to fix

                      Function createEllipseBorder has 6 arguments (exceeds 5 allowed). Consider refactoring.
                      Open

                      function createEllipseBorder(figure, x, y, w, h, pos = 'leftTop') {
                      Severity: Minor
                      Found in src/utils/border_radius.js - About 35 mins to fix

                        Function drawTexture has a Cognitive Complexity of 27 (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function drawTexture(node, mesh) {
                          const textureImage = node.textureImage instanceof String // for wechat miniprogram
                            ? String(node.textureImage) : node.textureImage;
                          const textureImageRotated = node.textureImageRotated;
                          const texture = mesh.texture;
                        Severity: Minor
                        Found in src/utils/texture.js - 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 '';
                        Severity: Major
                        Found in src/selector/index.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return true;
                          Severity: Major
                          Found in src/node/cloud.js - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language