ReCreateJS/txtjs

View on GitHub

Showing 143 of 340 total issues

Avoid deeply nested control flow statements.
Open

                    if i.has_attr('glyph-name'):
                        print( 'CHARS[ "' + unicode_str + '" ] = 1' )
                    else:
                        print( 'CHARS[ "' + unicode_str + '" ] = 1 ' )
                    continue
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 (i < len - 1) {
                vPosition = 0;
              }
      Severity: Major
      Found in src/Text.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

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

          Avoid deeply nested control flow statements.
          Open

                              if CHARS.has_key( unicode_str ) and CHARS[ unicode_str ] != 1:
                                  unicode_str = CHARS[ unicode_str ]
          
          
          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

              Function update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                static update() {
                  Accessibility.timeout = null;
                  const data = Accessibility.data.slice(0);
                  data.sort(function(a, b) {
                    return a.accessibilityPriority - b.accessibilityPriority;
              Severity: Minor
              Found in src/Accessibility.ts - About 45 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 (
                            char._font.ligatures[ligTarget.charAt(0)][ligTarget.charAt(1)][
                              ligTarget.charAt(2)
                            ]
                          ) {
              Severity: Major
              Found in src/PathText.ts - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

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

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

                    constructor(
                      x1: number[],
                      rx: number,
                      ry: number,
                      phiarg: number,
                  Severity: Minor
                  Found in src/SVGArc.ts - About 45 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.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.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 (position < 0) {
                                  position = position + 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;
                                    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 (position < 0) {
                                      position = position + this.length;
                                    }
                          Severity: Major
                          Found in src/Path.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

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

                              Function addText has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                function addText(font, tracking, xPos, yPos, size) {
                              Severity: Minor
                              Found in examples/CharacterText/tracking_layout_test.ts - About 35 mins to fix

                                Function addText has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  function addText(font, tracking, xPos, yPos, size) {
                                Severity: Minor
                                Found in examples/Text/tracking_layout_test.ts - About 35 mins to fix

                                  Function fontsFromCharacterStyles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    private fontsFromCharacterStyles(styles) {
                                      const styleFonts = [];
                                      if (styles) {
                                        for (let i = 0; i < styles.length; ++i) {
                                          if (styles[i] != undefined && styles[i].font != undefined) {
                                  Severity: Minor
                                  Found in src/TextContainer.ts - About 35 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 too many return statements within this function.
                                  Open

                                        return this.text.charAt(index).charCodeAt(0);
                                  Severity: Major
                                  Found in src/TextContainer.ts - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language