spritejs/spritejs

View on GitHub

Showing 126 of 126 total issues

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

      Object.entries(frame).forEach(([key, value]) => {
        ret[key] = Effects[key] ? value : parseValue(value);
      });
Severity: Minor
Found in src/animation/index.js and 1 other location - About 55 mins to fix
src/animation/index.js on lines 54..56

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 53.

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

    Object.entries(initAttrs).forEach(([key, value]) => {
      initAttrs[key] = Effects[key] ? value : parseValue(value);
    });
Severity: Minor
Found in src/animation/index.js and 1 other location - About 55 mins to fix
src/animation/index.js on lines 60..62

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 53.

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

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

  remove() {
    if(this.parent && this.parent.removeChild) {
      this.parent.removeChild(this);
      return true;
    }
Severity: Minor
Found in src/node/node.js and 1 other location - About 50 mins to fix
src/node/layer-worker.js on lines 67..73

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 52.

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

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

  get isVisible() {
    const {sides} = this.attributes;
    return sides[0] > 0 && sides[1] > 0 && super.isVisible;
  }
Severity: Minor
Found in src/node/triangle.js and 1 other location - About 50 mins to fix
src/node/parallel.js on lines 9..12

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 52.

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

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

    remove() {
      if(this.parent && this.parent.removeChild) {
        this.parent.removeChild(this);
        return true;
      }
Severity: Minor
Found in src/node/layer-worker.js and 1 other location - About 50 mins to fix
src/node/node.js on lines 502..508

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 52.

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

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

  get isVisible() {
    const {sides} = this.attributes;
    return sides[0] > 0 && sides[1] > 0 && super.isVisible;
  }
Severity: Minor
Found in src/node/parallel.js and 1 other location - About 50 mins to fix
src/node/triangle.js on lines 8..11

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 52.

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

      y1 = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
Severity: Minor
Found in src/utils/smooth_curve.js and 1 other location - About 50 mins to fix
src/utils/smooth_curve.js on lines 37..37

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 51.

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

      x1 = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
Severity: Minor
Found in src/utils/smooth_curve.js and 1 other location - About 50 mins to fix
src/utils/smooth_curve.js on lines 38..38

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 51.

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

      x0 = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
Severity: Minor
Found in src/utils/smooth_curve.js and 1 other location - About 50 mins to fix
src/utils/smooth_curve.js on lines 29..29

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 51.

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

      y0 = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
Severity: Minor
Found in src/utils/smooth_curve.js and 1 other location - About 50 mins to fix
src/utils/smooth_curve.js on lines 28..28

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 51.

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

Avoid deeply nested control flow statements.
Open

            if(svgNode.attributes.flexible) {
              svgNode.attributes.textureRect = null;
            }
Severity: Major
Found in src/node/spritesvg.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

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

      Avoid deeply nested control flow statements.
      Open

                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(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
                      Severity
                      Category
                      Status
                      Source
                      Language