spritejs/sprite-core

View on GitHub

Showing 86 of 120 total issues

Function drawBgImage has 7 arguments (exceeds 5 allowed). Consider refactoring.
Open

function drawBgImage(drawingContext, bgimage, borderWidth, offsetWidth, offsetHeight, clientWidth, clientHeight) {
Severity: Major
Found in src/core/basesprite.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if(value != null) break;
    Severity: Major
    Found in src/utils/decorators.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if(pv !== ret.pv) {
                    this[key] = ret.rv;
                    return this[key];
                  }
      Severity: Major
      Found in src/utils/decorators.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if(evt.terminated && type !== 'mousemove') {
                      break;
                    }
        Severity: Major
        Found in src/core/group.js - About 45 mins to fix

          Consider simplifying this complex logical expression.
          Open

                if(key === 'fontSize'
                  || key === 'fontFamily'
                  || key === 'fontStyle'
                  || key === 'fontVariant'
                  || key === 'fontWeight') {
          Severity: Major
          Found in src/core/basenode.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                  if(bgimage && bgimage.display !== 'none' || borderRadius && (this.nodeType !== 'sprite' || this.textures && this.textures.length)) {
                    drawingContext.clip();
                  }
            Severity: Major
            Found in src/core/basesprite.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/modules/animation/animation.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                      if(layerX == null && layerY == null
                        || layerX >= 0 && layerY >= 0 && layerX < width && layerY < height) {
                        return true;
                      }
                Severity: Major
                Found in src/core/layer.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                        if(cache || reflow || relayout || quiet || value || extra) {
                          throw new Error('Cannot apply state to composit attribute.');
                        }
                  Severity: Major
                  Found in src/utils/decorators.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if(!this.cacheContext || borderWidth || borderRadius || bgcolor || bgimage && bgimage.display !== 'none') {
                          let [x, y, w, h, r] = [borderWidth, borderWidth,
                            clientWidth, clientHeight,
                            borderRadius];
                    
                    
                    Severity: Major
                    Found in src/core/basesprite.js - About 40 mins to fix

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

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

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

                        function drawDot9Image(drawingContext, image, clip9, borderWidth, offsetWidth, offsetHeight, clientWidth, clientHeight) {
                          const w = image.width,
                            h = image.height;
                        
                          const [top, right, bottom, left] = clip9 || [16, 16, 16, 16];
                        Severity: Minor
                        Found in src/core/basesprite.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 this[_attr].attrs;
                        Severity: Major
                        Found in src/core/basenode.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return false;
                          Severity: Major
                          Found in src/core/basesprite.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return this[_data];
                            Severity: Major
                            Found in src/core/basenode.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                return [...val, 0, 0, 0, 0, 0, 0, 0, 0].slice(0, 8);
                              Severity: Major
                              Found in src/utils/utils.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return this[_attr][props];
                                Severity: Major
                                Found in src/core/basenode.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return true;
                                  Severity: Major
                                  Found in src/core/basesprite.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                return ret.rv;
                                    Severity: Major
                                    Found in src/utils/decorators.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return this;
                                      Severity: Major
                                      Found in src/core/basenode.js - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language