ReCreateJS/txtjs

View on GitHub

Showing 340 of 340 total issues

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

      style: Array.from(Array(14).keys()).map(val => {
        const hex = val.toString(16);
        const unhex = (14 - val).toString(16);
        return {
          fillColor:
Severity: Major
Found in examples/Text/stroke.ts and 2 other locations - About 4 hrs to fix
examples/CharacterText/stroke.ts on lines 20..29
site/demo.ts on lines 17..26

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

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 3 locations. Consider refactoring.
Open

    style: Array.from(Array(14).keys()).map(val => {
      const hex = val.toString(16);
      const unhex = (14 - val).toString(16);
      return {
        fillColor:
Severity: Major
Found in site/demo.ts and 2 other locations - About 4 hrs to fix
examples/CharacterText/stroke.ts on lines 20..29
examples/Text/stroke.ts on lines 19..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 131.

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 3 locations. Consider refactoring.
Open

      style: Array.from(Array(14).keys()).map(val => {
        const hex = val.toString(16);
        const unhex = (14 - val).toString(16);
        return {
          fillColor:
Severity: Major
Found in examples/CharacterText/stroke.ts and 2 other locations - About 4 hrs to fix
examples/Text/stroke.ts on lines 19..28
site/demo.ts on lines 17..26

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

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

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

            for (let i = 0; i < len; i++) {
              current = charMetrics[i];
              metricBaseWidth = metricBaseWidth + current.offset + current.kerning;
              metricRealWidth =
                metricRealWidth + (current.offset + current.kerning) * current.size;
        Severity: Major
        Found in src/CharacterText.ts and 1 other location - About 4 hrs to fix
        src/PathText.ts on lines 263..271

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

        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

            for (let i = 0; i < len; i++) {
              current = charMetrics[i];
              metricBaseWidth = metricBaseWidth + current.offset + current.kerning;
              metricRealWidth =
                metricRealWidth + (current.offset + current.kerning) * current.size;
        Severity: Major
        Found in src/PathText.ts and 1 other location - About 4 hrs to fix
        src/CharacterText.ts on lines 228..236

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

        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

              } else {
                if (this.start > this.end) {
                  this.realLength = this.start - this.end;
                  this.center = this.start - this.realLength / 2;
                } else {
        Severity: Major
        Found in src/Path.ts and 1 other location - About 4 hrs to fix
        src/Path.ts on lines 95..103

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

        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 (this.flipped == false) {
                if (this.start > this.end) {
                  this.realLength = this.start - this.end;
                  this.center = this.start - this.realLength / 2;
                } else {
        Severity: Major
        Found in src/Path.ts and 1 other location - About 4 hrs to fix
        src/Path.ts on lines 103..111

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

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

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

                        if (trackMetric > this.original.tracking && this.autoExpand) {
                          if (this.maxTracking != null && trackMetric > this.maxTracking) {
                            this.tracking = this.maxTracking;
                          } else {
                            this.tracking = trackMetric;
                  Severity: Major
                  Found in src/CharacterText.ts and 1 other location - About 3 hrs to fix
                  src/PathText.ts on lines 301..309

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

                  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 (trackMetric > this.original.tracking && this.autoExpand) {
                          if (this.maxTracking != null && trackMetric > this.maxTracking) {
                            this.tracking = this.maxTracking;
                          } else {
                            this.tracking = trackMetric;
                  Severity: Major
                  Found in src/PathText.ts and 1 other location - About 3 hrs to fix
                  src/CharacterText.ts on lines 262..270

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

                  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 (trackMetric < this.original.tracking && this.autoReduce) {
                          if (this.maxTracking != null && trackMetric > this.maxTracking) {
                            this.tracking = this.maxTracking;
                          } else {
                            this.tracking = trackMetric;
                  Severity: Major
                  Found in src/PathText.ts and 1 other location - About 3 hrs to fix
                  src/CharacterText.ts on lines 272..280

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

                  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 (trackMetric < this.original.tracking && this.autoReduce) {
                          if (this.maxTracking != null && trackMetric > this.maxTracking) {
                            this.tracking = this.maxTracking;
                          } else {
                            this.tracking = trackMetric;
                  Severity: Major
                  Found in src/CharacterText.ts and 1 other location - About 3 hrs to fix
                  src/PathText.ts on lines 311..319

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

                  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

                    stage.addChild(
                      new txt.PathText({
                        x: 420,
                        y: 420,
                        flipped: false,
                  Severity: Major
                  Found in examples/PathText/flipped.ts and 1 other location - About 3 hrs to fix
                  examples/PathText/flipped.ts on lines 9..26

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language