ReCreateJS/txtjs

View on GitHub

Showing 340 of 340 total issues

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

export default function init() {
  const canvas = createHiDPICanvas(612, 744, 1);
  document.body.appendChild(canvas);
  const stage = new createjs.Stage(canvas);

Severity: Major
Found in examples/CharacterText/wordwrap_natural_lineheight.ts and 3 other locations - About 7 hrs to fix
examples/CharacterText/wordwrap_newline_error.ts on lines 3..29
examples/Text/wordwrap_natural_lineheight.ts on lines 3..29
examples/Text/wordwrap_newline_error.ts on lines 3..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 175.

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 4 locations. Consider refactoring.
Open

export default function init() {
  const canvas = createHiDPICanvas(400, 900, 1);
  document.body.appendChild(canvas);
  const stage = new createjs.Stage(canvas);

Severity: Major
Found in examples/Text/wordwrap_newline_error.ts and 3 other locations - About 7 hrs to fix
examples/CharacterText/wordwrap_natural_lineheight.ts on lines 3..29
examples/CharacterText/wordwrap_newline_error.ts on lines 3..29
examples/Text/wordwrap_natural_lineheight.ts on lines 3..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 175.

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 4 locations. Consider refactoring.
Open

export default function init() {
  const canvas = createHiDPICanvas(400, 900, 1);
  document.body.appendChild(canvas);
  const stage = new createjs.Stage(canvas);

Severity: Major
Found in examples/CharacterText/wordwrap_newline_error.ts and 3 other locations - About 7 hrs to fix
examples/CharacterText/wordwrap_natural_lineheight.ts on lines 3..29
examples/Text/wordwrap_natural_lineheight.ts on lines 3..29
examples/Text/wordwrap_newline_error.ts on lines 3..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 175.

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

File characters.py has 441 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python
# -*- coding: utf8 -*-

#unicodeRange="U+0020-U+007E,U+00A1-U+00FF,U+2010-U+2036"

Severity: Minor
Found in tools/font_export/characters.py - About 6 hrs to fix

    Function init has 162 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function init() {
      const canvas = createHiDPICanvas(650, 650, 2);
      document.body.appendChild(canvas);
      const stage = new createjs.Stage(canvas);
      stage.x = 10;
    Severity: Major
    Found in examples/PathText/alignment.ts - About 6 hrs to fix

      Function measure has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

        measure(): boolean {
          this.measured = true;
          //Extract orgin sizing from this.original to preserve
          //metrics. autoMeasure will change style properties
          //directly. Change this.original to rerender.
      Severity: Minor
      Found in src/PathText.ts - About 6 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

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

        stage.addChild(
          new txt.CharacterText({
            text: label,
            font: "lobster",
            lineHeight: 150,
      Severity: Major
      Found in examples/CharacterText/stroke.ts and 1 other location - About 6 hrs to fix
      examples/Text/stroke.ts on lines 35..54

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

      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

        stage.addChild(
          new txt.Text({
            text: label,
            font: "lobster",
            lineHeight: 150,
      Severity: Major
      Found in examples/Text/stroke.ts and 1 other location - About 6 hrs to fix
      examples/CharacterText/stroke.ts on lines 36..55

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

      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

      File Text.ts has 415 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import TextContainer from "./TextContainer";
      import Align from "./Align";
      import FontLoader from "./FontLoader";
      import Word from "./Word";
      import Line from "./Line";
      Severity: Minor
      Found in src/Text.ts - About 5 hrs to fix

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

        export default function init() {
          const canvas = createHiDPICanvas(1000, 1000, 2);
          document.body.appendChild(canvas);
          const stage = new createjs.Stage(canvas);
        
        
        Severity: Major
        Found in examples/Text/moon.ts and 1 other location - About 5 hrs to fix
        examples/Text/card_test.ts on lines 5..27

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

        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

        export default function init() {
          const canvas = createHiDPICanvas(1000, 1000, 2);
          document.body.appendChild(canvas);
          const stage = new createjs.Stage(canvas);
        
        
        Severity: Major
        Found in examples/Text/card_test.ts and 1 other location - About 5 hrs to fix
        examples/Text/moon.ts on lines 5..27

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

        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

                case "T":
                  ctlPtx = cpx;
                  ctlPty = cpy;
                  prevCmd = ca[ca.length - 1];
                  if (prevCmd.command === "Q") {
        Severity: Major
        Found in src/SVGPath.ts and 1 other location - About 5 hrs to fix
        src/SVGPath.ts on lines 210..222

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

        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

                case "t":
                  ctlPtx = cpx;
                  ctlPty = cpy;
                  prevCmd = ca[ca.length - 1];
                  if (prevCmd.command === "Q") {
        Severity: Major
        Found in src/SVGPath.ts and 1 other location - About 5 hrs to fix
        src/SVGPath.ts on lines 196..208

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

        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 measure has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

          measure(): boolean {
            this.measured = true;
            //Extract origin sizing from this.original to preserve
            //metrics. autoMeasure will change style properties
            //directly. Change this.original to re-render.
        Severity: Minor
        Found in src/CharacterText.ts - About 5 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

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

                case "a":
                  rx = p.shift();
                  ry = p.shift();
                  psi = p.shift();
                  fa = p.shift();
        Severity: Major
        Found in src/SVGPath.ts and 1 other location - About 5 hrs to fix
        src/SVGPath.ts on lines 224..236

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

        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

                case "A":
                  rx = p.shift();
                  ry = p.shift();
                  psi = p.shift();
                  fa = p.shift();
        Severity: Major
        Found in src/SVGPath.ts and 1 other location - About 5 hrs to fix
        src/SVGPath.ts on lines 238..250

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

        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

        File Path.ts has 393 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        export enum PathFit {
          Rainbow,
          Stairstep
        }
        
        
        Severity: Minor
        Found in src/Path.ts - About 5 hrs to fix

          Function wordLayout has 135 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            wordLayout() {
              // loop over words
              // place into lines
              const len = this.words.length;
              let currentLine = new Line();
          Severity: Major
          Found in src/Text.ts - About 5 hrs to fix

            Function loadFont has 130 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static loadFont(fontName: string, loader: any) {
                //determine if font exists in memory
                if (FontLoader.fonts.hasOwnProperty(fontName)) {
                  //loading complete
                  if (FontLoader.fonts[fontName].loaded === true) {
            Severity: Major
            Found in src/FontLoader.ts - About 5 hrs to fix

              Function init has 128 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function init() {
                const canvas = createHiDPICanvas(380, 400, 2);
                document.body.appendChild(canvas);
                const stage = new createjs.Stage(canvas);
                stage.scaleX = stage.scaleY = 2;
              Severity: Major
              Found in examples/PathText/layout.ts - About 5 hrs to fix
                Severity
                Category
                Status
                Source
                Language