zxing-js/library

View on GitHub

Showing 958 of 958 total issues

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

        if (this.upInit < 0 || this.leftInit < 0 || this.downInit >= this.height || this.rightInit >= this.width) {
            throw new NotFoundException();
        }
Severity: Major
Found in src/core/common/detector/CornerDetector.ts and 1 other location - About 1 hr to fix
src/core/common/detector/WhiteRectangleDetector.ts on lines 75..77

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

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.upInit < 0 || this.leftInit < 0 || this.downInit >= this.height || this.rightInit >= this.width) {
            throw new NotFoundException();
        }
Severity: Major
Found in src/core/common/detector/WhiteRectangleDetector.ts and 1 other location - About 1 hr to fix
src/core/common/detector/CornerDetector.ts on lines 49..51

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

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 < Code39Reader.CHARACTER_ENCODINGS.length; i++) {
      if (Code39Reader.CHARACTER_ENCODINGS[i] === pattern) {
        return Code39Reader.ALPHABET_STRING.charAt(i);
      }
    }
Severity: Major
Found in src/core/oned/Code39Reader.ts and 1 other location - About 1 hr to fix
src/core/oned/Code93Reader.ts on lines 190..194

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

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 < Code93Reader.CHARACTER_ENCODINGS.length; i++) {
      if (Code93Reader.CHARACTER_ENCODINGS[i] === pattern) {
        return Code93Reader.ALPHABET_STRING.charAt(i);
      }
    }
Severity: Major
Found in src/core/oned/Code93Reader.ts and 1 other location - About 1 hr to fix
src/core/oned/Code39Reader.ts on lines 253..257

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

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 decodeAnsiX12Segment has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private static decodeAnsiX12Segment(bits: BitSource,
                                           result: StringBuilder): void {
    // Three ANSI X12 values are encoded in a 16-bit value as
    // (1600 * C1) + (40 * C2) + C3 + 1

Severity: Minor
Found in src/core/datamatrix/decoder/DecodedBitStreamParser.ts - About 1 hr to fix

    Function createECCBlock has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private static createECCBlock(codewords: string, numECWords: number): string {
        let table = -1;
        for (let i = 0; i < FACTOR_SETS.length; i++) {
          if (FACTOR_SETS[i] === numECWords) {
            table = i;
    Severity: Minor
    Found in src/core/datamatrix/encoder/ErrorCorrection.ts - About 1 hr to fix

      Function readCodewords has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public readCodewords(): Uint8Array /*throws FormatException*/ {
      
              const formatInfo = this.readFormatInformation();
              const version = this.readVersion();
      
      
      Severity: Minor
      Found in src/core/qrcode/decoder/BitMatrixParser.ts - About 1 hr to fix

        Function detect has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private static detect( multiple: boolean,  bitMatrix: BitMatrix): Array<ResultPoint[]> {
            const barcodeCoordinates = new Array<ResultPoint[]>();
            let row = 0;
            let column = 0;
            let foundBarcodeInRow = false;
        Severity: Minor
        Found in src/core/pdf417/detector/Detector.ts - About 1 hr to fix

          Function runEuclideanAlgorithm has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private runEuclideanAlgorithm(a: ModulusPoly, b: ModulusPoly, R: int): ModulusPoly[] {
              // Assume a's degree is >= b's
              if (a.getDegree() < b.getDegree()) {
                let temp: ModulusPoly = a;
                a = b;
          Severity: Minor
          Found in src/core/pdf417/decoder/ec/ErrorCorrection.ts - About 1 hr to fix

            Function adjustRowNumbers has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private adjustRowNumbers(barcodeColumn: int, codewordsRow: int, codewords: Codeword[]): void {
                if (this.detectionResultColumns[barcodeColumn - 1] == null) {
                  return;
                }
            
            
            Severity: Minor
            Found in src/core/pdf417/decoder/DetectionResult.ts - About 1 hr to fix

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

                      for (let i = length - 2; i >= 0; i -= 2) {
                          sum += s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
                      }
              Severity: Major
              Found in src/core/oned/UPCEANExtension5Support.ts and 1 other location - About 1 hr to fix
              src/core/oned/UPCEANExtension5Support.ts on lines 103..105

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

              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 = length - 1; i >= 0; i -= 2) {
                          sum += s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
                      }
              Severity: Major
              Found in src/core/oned/UPCEANExtension5Support.ts and 1 other location - About 1 hr to fix
              src/core/oned/UPCEANExtension5Support.ts on lines 99..101

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

              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

                  public equals(o: Object): boolean {
                      if (!(o instanceof FormatInformation)) {
                          return false;
                      }
                      const other = <FormatInformation>o;
              Severity: Major
              Found in src/core/qrcode/decoder/FormatInformation.ts and 1 other location - About 1 hr to fix
              src/core/oned/rss/DataCharacter.ts on lines 23..29

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

              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

                  public equals(o: object): boolean {
                      if (!(o instanceof DataCharacter)) {
                          return false;
                      }
                      const that = <DataCharacter>o;
              Severity: Major
              Found in src/core/oned/rss/DataCharacter.ts and 1 other location - About 1 hr to fix
              src/core/qrcode/decoder/FormatInformation.ts on lines 151..158

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

              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

                          case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:
                            let fileName: StringBuilder = new StringBuilder();
                            codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, fileName);
                            resultMetadata.setFileName(fileName.toString());
                            break;
              Severity: Major
              Found in src/core/pdf417/decoder/DecodedBitStreamParser.ts and 2 other locations - About 1 hr to fix
              src/core/pdf417/decoder/DecodedBitStreamParser.ts on lines 296..300
              src/core/pdf417/decoder/DecodedBitStreamParser.ts on lines 301..305

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

              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

                          case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SENDER:
                            let sender: StringBuilder = new StringBuilder();
                            codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, sender);
                            resultMetadata.setSender(sender.toString());
                            break;
              Severity: Major
              Found in src/core/pdf417/decoder/DecodedBitStreamParser.ts and 2 other locations - About 1 hr to fix
              src/core/pdf417/decoder/DecodedBitStreamParser.ts on lines 291..295
              src/core/pdf417/decoder/DecodedBitStreamParser.ts on lines 301..305

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

              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

                          case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:
                            let addressee: StringBuilder = new StringBuilder();
                            codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, addressee);
                            resultMetadata.setAddressee(addressee.toString());
                            break;
              Severity: Major
              Found in src/core/pdf417/decoder/DecodedBitStreamParser.ts and 2 other locations - About 1 hr to fix
              src/core/pdf417/decoder/DecodedBitStreamParser.ts on lines 291..295
              src/core/pdf417/decoder/DecodedBitStreamParser.ts on lines 296..300

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

              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 getDataBytes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getDataBytes(): Uint8Array {
                  switch (this.mode) {
                    case Mode.ASCII:
                      if (this.input.isECI(this.fromPosition)) {
                        return Edge.getBytes(
              Severity: Minor
              Found in src/core/datamatrix/encoder/MinimalEncoder.ts - About 1 hr to fix

                Function transitionsBetween has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private transitionsBetween(from: ResultPoint, to: ResultPoint): int {
                    // See QR Code Detector, sizeOfBlackWhiteBlackRun()
                    let fromX = Math.trunc(from.getX());
                    let fromY = Math.trunc(from.getY());
                    let toX = Math.trunc(to.getX());
                Severity: Minor
                Found in src/core/datamatrix/detector/Detector.ts - About 1 hr to fix

                  Function readBits has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public readBits(numBits: number /*int*/): number /*int*/ {
                          if (numBits < 1 || numBits > 32 || numBits > this.available()) {
                              throw new IllegalArgumentException('' + numBits);
                          }
                  
                  
                  Severity: Minor
                  Found in src/core/common/BitSource.ts - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language