ReCreateJS/txtjs

View on GitHub

Showing 340 of 340 total issues

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

  setAlign(align: PathAlign = PathAlign.Center) {
    this.align = align;
    this.pathPoints.align = this.align;
    this.pathPoints.update();
  }
Severity: Major
Found in src/PathText.ts and 1 other location - About 1 hr to fix
src/PathText.ts on lines 86..90

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

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

  setFit(fit: PathFit = PathFit.Rainbow) {
    this.fit = fit;
    this.pathPoints.fit = this.fit;
    this.pathPoints.update();
  }
Severity: Major
Found in src/PathText.ts and 1 other location - About 1 hr to fix
src/PathText.ts on lines 92..96

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

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 init has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function init() {
  const canvas = createHiDPICanvas(480, 480, 2);
  document.body.appendChild(canvas);
  const stage = new createjs.Stage(canvas);
  stage.x = 50;
Severity: Minor
Found in examples/PathText/circle_last_char.ts - About 1 hr to fix

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

    export default function init() {
      const canvas = createHiDPICanvas(300, 1800, 1);
      document.body.appendChild(canvas);
      const stage = new createjs.Stage(canvas);
    
    
    Severity: Minor
    Found in examples/Text/wordwrap_calc.ts - About 1 hr to fix

      Function ligatureSwap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        protected ligatureSwap(char: Character, ligTarget: string) {
          let advanceBy = 0;
          const firstChar = ligTarget.charAt(0);
          const firstLigature = char._font.ligatures[firstChar];
          //1 char match
      Severity: Minor
      Found in src/TextContainer.ts - About 1 hr 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

      Function addDebugLayout has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private addDebugLayout() {
          let s = new createjs.Shape();
          s.graphics.beginStroke("#FF0000");
          s.graphics.setStrokeStyle(0.1);
          s.graphics.decodeSVGPath(this.path);
      Severity: Minor
      Found in src/PathText.ts - About 1 hr to fix

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

        export default function init() {
          const canvas = createHiDPICanvas(850, 500, 1);
          document.body.appendChild(canvas);
          const stage = new createjs.Stage(canvas);
        
        
        Severity: Minor
        Found in examples/CharacterText/cache.ts - About 1 hr to fix

          Function layout has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            layout() {
              this.addAccessibility();
              this.overset = false;
              this.oversetIndex = null;
              this.removeAllChildren();
          Severity: Minor
          Found in src/PathText.ts - About 1 hr to fix

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

              offsetTracking(offset: number, size: number, units: number): number {
                return Math.floor(((offset - 2.5 / units - 1 / 900) * 990) / size);
              }
            Severity: Major
            Found in src/PathText.ts and 1 other location - About 1 hr to fix
            src/CharacterText.ts on lines 289..291

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

            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

              offsetTracking(offset: number, size: number, units: number): number {
                return Math.floor(((offset - 2.5 / units - 1 / 900) * 990) / size);
              }
            Severity: Major
            Found in src/CharacterText.ts and 1 other location - About 1 hr to fix
            src/PathText.ts on lines 585..587

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

            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 init has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function init() {
              const canvas = createHiDPICanvas(600, 220, 2);
              document.body.appendChild(canvas);
              const stage = new createjs.Stage(canvas);
              stage.scaleX = stage.scaleY = 4;
            Severity: Minor
            Found in examples/PathText/vertical_alignment_layout.ts - About 1 hr to fix

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

              export default function init() {
                const canvas = createHiDPICanvas(520, 320, 1);
                document.body.appendChild(canvas);
                const stage = new createjs.Stage(canvas);
              
              
              Severity: Minor
              Found in examples/Text/alignment.ts - About 1 hr to fix

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

                export default function init() {
                  const canvas = createHiDPICanvas(520, 320, 1);
                  document.body.appendChild(canvas);
                  const stage = new createjs.Stage(canvas);
                
                
                Severity: Minor
                Found in examples/CharacterText/alignment.ts - About 1 hr to fix

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

                        const d0 = Math.sqrt(
                          Math.pow(pp0.x - ppc["x"], 2) + Math.pow(pp0.y - ppc["y"], 2)
                        );
                  Severity: Major
                  Found in src/Path.ts and 1 other location - About 1 hr to fix
                  src/Path.ts on lines 366..368

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

                  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

                        const d1 = Math.sqrt(
                          Math.pow(pp1.x - ppc["x"], 2) + Math.pow(pp1.y - ppc["y"], 2)
                        );
                  Severity: Major
                  Found in src/Path.ts and 1 other location - About 1 hr to fix
                  src/Path.ts on lines 362..364

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

                  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 init has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function init() {
                    const canvas = createHiDPICanvas(900, 500, 2);
                    document.body.appendChild(canvas);
                    const stage = new createjs.Stage(canvas);
                  
                  
                  Severity: Minor
                  Found in examples/CharacterText/text.ts - About 1 hr to fix

                    Function layout has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      layout() {
                        this.addAccessibility();
                    
                        this.overset = false;
                        this.measured = false;
                    Severity: Minor
                    Found in src/CharacterText.ts - About 1 hr 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

                        const defaultStyle = {
                          size: this.original.size,
                          font: this.original.font,
                          tracking: this.original.tracking,
                          characterCase: this.original.characterCase
                    Severity: Major
                    Found in src/CharacterText.ts and 1 other location - About 1 hr to fix
                    src/PathText.ts on lines 190..195

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

                    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

                        const defaultStyle = {
                          size: this.original.size,
                          font: this.original.font,
                          tracking: this.original.tracking,
                          characterCase: this.original.characterCase
                    Severity: Major
                    Found in src/PathText.ts and 1 other location - About 1 hr to fix
                    src/CharacterText.ts on lines 154..159

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

                    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 init has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function init() {
                      const canvas = createHiDPICanvas(610, 610, 2);
                      document.body.appendChild(canvas);
                      const stage = new createjs.Stage(canvas);
                    
                    
                    Severity: Minor
                    Found in examples/CharacterText/accessibility.ts - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language