spritejs/sprite-core

View on GitHub

Showing 120 of 120 total issues

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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                            Object.keys(states.beforeEnter).forEach((key) => {
                              afterEnter[key] = this.attr(key);
                            });
                  Severity: Minor
                  Found in src/modules/actions/node.js and 2 other locations - About 40 mins to fix
                  src/modules/actions/node.js on lines 231..233
                  src/modules/actions/node.js on lines 235..237

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 48.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                              Object.keys(states.beforeShow).forEach((key) => {
                                beforeHide[key] = this.attr(key);
                              });
                  Severity: Minor
                  Found in src/modules/actions/node.js and 2 other locations - About 40 mins to fix
                  src/modules/actions/node.js on lines 235..237
                  src/modules/actions/node.js on lines 274..276

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 48.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                            Object.keys(states.hide).forEach((key) => {
                              beforeHide[key] = this.attr(key);
                            });
                  Severity: Minor
                  Found in src/modules/actions/node.js and 2 other locations - About 40 mins to fix
                  src/modules/actions/node.js on lines 231..233
                  src/modules/actions/node.js on lines 274..276

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 48.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                    const _resolveState = Symbol('resolveState'),
                      _changeStateAction = Symbol('changeStateAction'),
                      _show = Symbol('show'),
                      _hide = Symbol('hide'),
                      _enter = Symbol('enter');
                    Severity: Minor
                    Found in src/modules/actions/node.js and 2 other locations - About 35 mins to fix
                    src/core/attr.js on lines 3..7
                    src/core/basesprite.js on lines 9..13

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 47.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if('offsetY' in evt) parentY = evt.offsetY - this.originalRect[1] - borderWidth - padding[0] + scrollTop;
                    Severity: Minor
                    Found in src/core/group.js and 1 other location - About 35 mins to fix
                    src/core/group.js on lines 233..233

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 47.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                    const _animations = Symbol('animations'),
                      _cachePriority = Symbol('cachePriority'),
                      _effects = Symbol('effects'),
                      _flow = Symbol('flow'),
                      _releaseKeys = Symbol('releaseKeys');
                    Severity: Minor
                    Found in src/core/basesprite.js and 2 other locations - About 35 mins to fix
                    src/core/attr.js on lines 3..7
                    src/modules/actions/node.js on lines 21..25

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 47.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                    const _attr = Symbol('attr'),
                      _style = Symbol('style'),
                      _temp = Symbol('store'),
                      _subject = Symbol('subject'),
                      _default = Symbol('default');
                    Severity: Minor
                    Found in src/core/attr.js and 2 other locations - About 35 mins to fix
                    src/core/basesprite.js on lines 9..13
                    src/modules/actions/node.js on lines 21..25

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 47.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if('offsetX' in evt) parentX = evt.offsetX - this.originalRect[0] - borderWidth - padding[3] + scrollLeft;
                    Severity: Minor
                    Found in src/core/group.js and 1 other location - About 35 mins to fix
                    src/core/group.js on lines 234..234

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 47.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    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

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if(val && typeof val.then === 'function') {
                              return val.then((res) => {
                                setVal(props, res);
                              });
                            }
                    Severity: Minor
                    Found in src/core/basenode.js and 1 other location - About 35 mins to fix
                    src/core/basenode.js on lines 242..246

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 46.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      if(typeof to === 'string') {
                        matchTo = exp.exec(to);
                        if(matchTo) {
                          unitTo = matchTo[2];
                        }
                    Severity: Minor
                    Found in src/modules/animation/animation.js and 1 other location - About 35 mins to fix
                    src/modules/animation/animation.js on lines 16..21

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 46.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language