ReCreateJS/txtjs

View on GitHub

Showing 143 of 340 total issues

Function init has 28 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/Text/multiline_align.ts - About 1 hr to fix

    Function init has 28 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/Text/single_word_oneline.ts - About 1 hr to fix

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

      export default function init() {
        const canvas = createHiDPICanvas(300, 200, 2);
        document.body.appendChild(canvas);
      
        const output = document.createElement("p");
      Severity: Minor
      Found in examples/CharacterText/child_events.ts - About 1 hr to fix

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

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

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

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

            Function init has 26 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);
              let i = 1;
            Severity: Minor
            Found in examples/CharacterText/loadtest.ts - About 1 hr to fix

              Function init has 26 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);
                let i = 1;
              Severity: Minor
              Found in examples/Text/loadtest.ts - About 1 hr to fix

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

                  layout() {
                    this.addAccessibility();
                    this.overset = false;
                    this.oversetIndex = null;
                    this.removeAllChildren();
                Severity: Minor
                Found in src/PathText.ts - About 55 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

                Avoid deeply nested control flow statements.
                Open

                          if (this.center > this.length) {
                            this.center = this.center - this.length;
                          }
                Severity: Major
                Found in src/Path.ts - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if (this.align == PathAlign.Left) {
                              realStart = this.start;
                            } else if (this.align == PathAlign.Center) {
                              realStart = this.start - (this.realLength - characterLength) / 2;
                            } else if (this.align == PathAlign.Right) {
                  Severity: Major
                  Found in src/Path.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        for k in char_2:
                                            c_2 = k
                                            if CHARS.has_key( c_2 ) and CHARS[ c_2 ] != 1:
                                                c_2 = CHARS[ c_2 ]
                                            
                    Severity: Major
                    Found in tools/font_export/main.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                if (this.center > this.length) {
                                  this.center = this.center - this.length;
                                }
                      Severity: Major
                      Found in src/Path.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                  if (this.center > this.length) {
                                    this.center = this.center - this.length;
                                  }
                        Severity: Major
                        Found in src/Path.ts - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if (this.center > this.length) {
                                      this.center = this.center - this.length;
                                    }
                          Severity: Major
                          Found in src/Path.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                    if (firstLine == false && this.lineHeight != null) {
                                      currentLine.measuredHeight = this.lineHeight;
                                    } else {
                                      currentLine.measuredHeight = vPosition;
                                    }
                            Severity: Major
                            Found in src/Text.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                              for (let k = 0; k < pathLength; k++) {
                                                if (target[path[k]] == undefined) {
                                                  target[path[k]] = {};
                                                }
                                                if (k == pathLength - 1) {
                              Severity: Major
                              Found in src/FontLoader.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if i.has_attr('horiz-adv-x') and i.has_attr('d'):
                                                        out += '1|' + unicode_str + '|' + i['horiz-adv-x'] + '|' + i['d']  + '\n'
                                
                                                    elif i.has_attr('d') and i.has_attr('horiz-adv-x') == False:
                                                        out += '1|' + unicode_str + '|' + str( default ) + '|' + i['d']  + '\n'
                                Severity: Major
                                Found in tools/font_export/main.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                            if (this.align == PathAlign.Left) {
                                              realStart = this.start;
                                              position = realStart - distance;
                                            } else if (this.align == PathAlign.Center) {
                                              realStart = this.start - (this.realLength - characterLength) / 2;
                                  Severity: Major
                                  Found in src/Path.ts - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                              if (this.align == PathAlign.Left) {
                                                realStart = this.start;
                                              } else if (this.align == PathAlign.Center) {
                                                realStart = this.start + (this.realLength - characterLength) / 2;
                                              } else if (this.align == PathAlign.Right) {
                                    Severity: Major
                                    Found in src/Path.ts - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                              if (this.lineHeight != null) {
                                                lastHeight = currentLine.y + this.lineHeight;
                                              } else {
                                                lastHeight = currentLine.y + vPosition;
                                              }
                                      Severity: Major
                                      Found in src/Text.ts - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language