ReCreateJS/txtjs

View on GitHub

Showing 340 of 340 total issues

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

  text = new txt.CharacterText({
    text: "The fox jumped over the log.",
    font: "raleway",
    singleLine: true,
    tracking: -4,
Severity: Major
Found in examples/CharacterText/cache.ts and 1 other location - About 1 hr to fix
examples/CharacterText/text.ts on lines 23..35

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

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

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

Severity: Minor
Found in examples/CharacterText/wordwrap.ts - About 1 hr to fix

    Function layout has 46 lines of code (exceeds 25 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

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

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

        Function createDemo has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function createDemo(exampleElement) {
          const canvas = createHiDPICanvas(500, 300, 2);
          canvas.style.maxWidth = "100%";
          exampleElement.appendChild(canvas);
          stage = new createjs.Stage(canvas);
        Severity: Minor
        Found in site/demo.ts - About 1 hr to fix

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

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

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

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

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

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

                Function constructor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  constructor(character: string, style: {}, index: number = null) {
                    super();
                    this.set(style);
                    this.index = index;
                
                
                Severity: Minor
                Found in src/Character.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

                      if (currentStyle.tracking == 0 && this.ligatures == true) {
                        const ligTarget = this.text.substr(i, 4);
                        i = i + this.ligatureSwap(char, ligTarget);
                      }
                Severity: Major
                Found in src/Text.ts and 1 other location - About 1 hr to fix
                src/CharacterText.ts on lines 429..432

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

                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 (currentWord.children.length == 0) {
                      currentWord = this.words[this.words.length - 1];
                      hPosition = currentWord.measuredWidth;
                      vPosition = currentWord.measuredHeight;
                    }
                Severity: Major
                Found in src/Text.ts and 1 other location - About 1 hr to fix
                src/CharacterText.ts on lines 512..516

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

                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

                      if (currentStyle.tracking == 0 && this.ligatures == true) {
                        const ligTarget = this.text.substr(i, 4);
                        i = i + this.ligatureSwap(char, ligTarget);
                      }
                Severity: Major
                Found in src/CharacterText.ts and 1 other location - About 1 hr to fix
                src/Text.ts on lines 221..224

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

                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 (currentLine.children.length == 0) {
                      currentLine = this.lines[this.lines.length - 1];
                      hPosition = currentLine.measuredWidth;
                      vPosition = currentLine.measuredHeight;
                    }
                Severity: Major
                Found in src/CharacterText.ts and 1 other location - About 1 hr to fix
                src/Text.ts on lines 269..273

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

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

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

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

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

                    Consider simplifying this complex logical expression.
                    Open

                                if i.has_attr('u1') and i.has_attr('u2') and i.has_attr('k'):
                                    #print( i['u1'] + ":" + i['u2'] + ":" + i['k'] )
                                    
                                    if "," in i['u1'] and len( i['u1'] ) > 1:
                                        char_1 = i['u1'].split( ',' )
                    Severity: Critical
                    Found in tools/font_export/main.py - About 1 hr to fix

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

                        let text = new txt.CharacterText({
                          text: "The fox jumped over the log.",
                          font: "raleway",
                          tracking: -4,
                          lineHeight: 120,
                      Severity: Major
                      Found in examples/CharacterText/text.ts and 1 other location - About 1 hr to fix
                      examples/CharacterText/cache.ts on lines 17..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 68.

                      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

                        let text = new txt.CharacterText({
                          text: "The fox jumped over the log.",
                          font: "raleway",
                          tracking: -4,
                          lineHeight: 60,
                      Severity: Major
                      Found in examples/CharacterText/cache.ts and 1 other location - About 1 hr to fix
                      examples/CharacterText/text.ts on lines 8..19

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

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

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

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

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