zxing-js/library

View on GitHub
src/core/datamatrix/encoder/HighLevelEncoder.ts

Summary

Maintainability
F
1 wk
Test Coverage

Function lookAheadTestIntern has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

  static lookAheadTestIntern(
    msg: string,
    startpos: number,
    currentMode: number
  ): number {
Severity: Minor
Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 1 day 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 lookAheadTestIntern has 180 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static lookAheadTestIntern(
    msg: string,
    startpos: number,
    currentMode: number
  ): number {
Severity: Major
Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 7 hrs to fix

    File HighLevelEncoder.ts has 405 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // tslint:disable-next-line:no-circular-imports
    import { ASCIIEncoder } from './ASCIIEncoder';
    
    // tslint:disable-next-line:no-circular-imports
    import { Base256Encoder } from './Base256Encoder';
    Severity: Minor
    Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 5 hrs to fix

      Function encodeHighLevel has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public static encodeHighLevel(
          msg: string,
          shape = SymbolShapeHint.FORCE_NONE,
          minSize: Dimension = null,
          maxSize: Dimension = null,
      Severity: Major
      Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 2 hrs to fix

        Function lookAheadTest has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          static lookAheadTest(
            msg: string,
            startpos: number,
            currentMode: number
          ): number {
        Severity: Minor
        Found in src/core/datamatrix/encoder/HighLevelEncoder.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

        Function encodeHighLevel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          public static encodeHighLevel(
            msg: string,
            shape = SymbolShapeHint.FORCE_NONE,
            minSize: Dimension = null,
            maxSize: Dimension = null,
        Severity: Minor
        Found in src/core/datamatrix/encoder/HighLevelEncoder.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

        Avoid deeply nested control flow statements.
        Open

                    while (p < msg.length) {
                      const tc = msg.charCodeAt(p);
                      if (this.isX12TermSep(tc)) {
                        return X12_ENCODATION;
                      }
        Severity: Major
        Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 45 mins to fix

          Avoid too many return statements within this function.
          Open

                      return X12_ENCODATION;
          Severity: Major
          Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return C40_ENCODATION;
            Severity: Major
            Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return C40_ENCODATION;
              Severity: Major
              Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return ASCII_ENCODATION;
                Severity: Major
                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return C40_ENCODATION;
                  Severity: Major
                  Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return X12_ENCODATION;
                    Severity: Major
                    Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                return BASE256_ENCODATION;
                      Severity: Major
                      Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return TEXT_ENCODATION;
                        Severity: Major
                        Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                    return X12_ENCODATION;
                          Severity: Major
                          Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                      return EDIFACT_ENCODATION;
                            Severity: Major
                            Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return TEXT_ENCODATION;
                              Severity: Major
                              Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 30 mins to fix

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

                                  static isNativeText(ch: number): boolean {
                                    return (
                                      ch === ' '.charCodeAt(0) ||
                                      (ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0)) ||
                                      (ch >= 'a'.charCodeAt(0) && ch <= 'z'.charCodeAt(0))
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 1 other location - About 3 hrs to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 419..425

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

                                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

                                  static isNativeC40(ch: number): boolean {
                                    return (
                                      ch === ' '.charCodeAt(0) ||
                                      (ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0)) ||
                                      (ch >= 'A'.charCodeAt(0) && ch <= 'Z'.charCodeAt(0))
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 1 other location - About 3 hrs to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 427..433

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

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

                                      if (this.isNativeC40(c)) {
                                        charCounts[C40_ENCODATION] += 2.0 / 3.0;
                                      } else if (this.isExtendedASCII(c)) {
                                        charCounts[C40_ENCODATION] += 8.0 / 3.0;
                                      } else {
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 3 other locations - About 2 hrs to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 237..243
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 246..252
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 255..261

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

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

                                      if (this.isNativeText(c)) {
                                        charCounts[TEXT_ENCODATION] += 2.0 / 3.0;
                                      } else if (this.isExtendedASCII(c)) {
                                        charCounts[TEXT_ENCODATION] += 8.0 / 3.0;
                                      } else {
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 3 other locations - About 2 hrs to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 228..234
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 246..252
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 255..261

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

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

                                      if (this.isNativeX12(c)) {
                                        charCounts[X12_ENCODATION] += 2.0 / 3.0;
                                      } else if (this.isExtendedASCII(c)) {
                                        charCounts[X12_ENCODATION] += 13.0 / 3.0;
                                      } else {
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 3 other locations - About 2 hrs to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 228..234
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 237..243
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 255..261

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

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

                                      if (this.isNativeEDIFACT(c)) {
                                        charCounts[EDIFACT_ENCODATION] += 3.0 / 4.0;
                                      } else if (this.isExtendedASCII(c)) {
                                        charCounts[EDIFACT_ENCODATION] += 17.0 / 4.0;
                                      } else {
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 3 other locations - About 2 hrs to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 228..234
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 237..243
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 246..252

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

                                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

                                    } else if (
                                      currentMode === EDIFACT_ENCODATION &&
                                      newMode === EDIFACT_ENCODATION
                                    ) {
                                      const endpos = Math.min(startpos + 4, msg.length);
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 1 other location - About 2 hrs to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 138..155

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

                                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 (currentMode === X12_ENCODATION && newMode === X12_ENCODATION) {
                                      const endpos = Math.min(startpos + 3, msg.length);
                                      for (let i = startpos; i < endpos; i++) {
                                        if (!this.isNativeX12(msg.charCodeAt(i))) {
                                          return ASCII_ENCODATION;
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 1 other location - About 2 hrs to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 145..155

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

                                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

                                        if (
                                          intCharCounts[X12_ENCODATION] + 1 <
                                          this.min(
                                            intCharCounts[BASE256_ENCODATION],
                                            intCharCounts[C40_ENCODATION],
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 2 other locations - About 55 mins to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 300..311
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 312..323

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

                                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

                                        if (
                                          intCharCounts[EDIFACT_ENCODATION] + 1 <
                                          this.min(
                                            intCharCounts[BASE256_ENCODATION],
                                            intCharCounts[C40_ENCODATION],
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 2 other locations - About 55 mins to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 312..323
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 324..335

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

                                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

                                        if (
                                          intCharCounts[TEXT_ENCODATION] + 1 <
                                          this.min(
                                            intCharCounts[BASE256_ENCODATION],
                                            intCharCounts[C40_ENCODATION],
                                Severity: Major
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 2 other locations - About 55 mins to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 300..311
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 324..335

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

                                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

                                  private static randomize253State(codewordPosition: number): number {
                                    const pseudoRandom = ((149 * codewordPosition) % 253) + 1;
                                    const tempVariable = PAD + pseudoRandom;
                                    return tempVariable <= 254 ? tempVariable : tempVariable - 254;
                                  }
                                Severity: Minor
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 1 other location - About 50 mins to fix
                                src/core/datamatrix/decoder/DecodedBitStreamParser.ts on lines 511..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 51.

                                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

                                  static isDigit(ch: number): boolean {
                                    return ch >= '0'.charCodeAt(0) && ch <= '9'.charCodeAt(0);
                                  }
                                Severity: Minor
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 1 other location - About 40 mins to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 452..454

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

                                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

                                  static isNativeEDIFACT(ch: number): boolean {
                                    return ch >= ' '.charCodeAt(0) && ch <= '^'.charCodeAt(0);
                                  }
                                Severity: Minor
                                Found in src/core/datamatrix/encoder/HighLevelEncoder.ts and 1 other location - About 40 mins to fix
                                src/core/datamatrix/encoder/HighLevelEncoder.ts on lines 411..413

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

                                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

                                There are no issues that match your filters.

                                Category
                                Status