ReCreateJS/txtjs

View on GitHub

Showing 143 of 340 total issues

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

    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

      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

      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

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

              export default function init() {
                const canvas = createHiDPICanvas(400, 500, 2);
                document.body.appendChild(canvas);
                const stage = new createjs.Stage(canvas);
              
              
              Severity: Major
              Found in examples/Text/perchar.ts - About 4 hrs to fix

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

                export default function init() {
                  const canvas = createHiDPICanvas(400, 600, 2);
                  document.body.appendChild(canvas);
                  const stage = new createjs.Stage(canvas);
                
                
                Severity: Major
                Found in examples/CharacterText/perchar.ts - About 4 hrs to fix

                  Function measure has 118 lines of code (exceeds 25 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: Major
                  Found in src/PathText.ts - About 4 hrs to fix

                    Function measure has 113 lines of code (exceeds 25 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: Major
                    Found in src/CharacterText.ts - About 4 hrs to fix

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

                      export default function init() {
                        const canvas = createHiDPICanvas(450, 500, 2);
                        document.body.appendChild(canvas);
                        const stage = new createjs.Stage(canvas);
                      
                      
                      Severity: Major
                      Found in examples/Text/percharfont.ts - About 4 hrs to fix

                        Function characterLayout has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          characterLayout(): boolean {
                            //characterlayout adds Charcters to words and measures true height. LineHeight is not a factor til Line layout.
                        
                            //char layout
                            const len = this.text.length;
                        Severity: Major
                        Found in src/Text.ts - About 4 hrs to fix

                          Function update has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            update() {
                              this.pathElement = document.createElementNS(
                                "http://www.w3.org/2000/svg",
                                "path"
                              ) as SVGPathElement;
                          Severity: Major
                          Found in src/Path.ts - About 4 hrs to fix

                            Function onload has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  req.onload = function() {
                                    //localstorage set
                                    if (localStorage && FontLoader.cache && this.cacheFont == undefined) {
                                      localStorage.setItem(
                                        "txt_font_" + fontName.split(" ").join("_"),
                            Severity: Major
                            Found in src/FontLoader.ts - About 3 hrs to fix

                              Function constructor has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                constructor(character: string, style: {}, index: number = null) {
                                  super();
                                  this.set(style);
                                  this.index = index;
                              
                              
                              Severity: Major
                              Found in src/Character.ts - About 3 hrs to fix

                                Function lineLayout has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  lineLayout() {
                                    // loop over lines
                                    // place into text
                                    let measuredHeight = 0;
                                    let line;
                                Severity: Minor
                                Found in src/CharacterText.ts - About 2 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

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

                                export default function init() {
                                  const canvas = createHiDPICanvas(1100, 700, 2);
                                  document.body.appendChild(canvas);
                                  const stage = new createjs.Stage(canvas);
                                  stage.scaleX = stage.scaleY = 1;
                                Severity: Major
                                Found in examples/CharacterText/tracking_layout_test.ts - About 2 hrs to fix

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

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