zxing-js/library

View on GitHub

Showing 958 of 958 total issues

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

    public equals(other: any): boolean {
        if (other instanceof Dimension) {
            const d = <Dimension>other;
            return this.width === d.width && this.height === d.height;
        }
Severity: Major
Found in src/core/Dimension.ts and 1 other location - About 1 hr to fix
src/core/ResultPoint.ts on lines 42..48

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

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 (min > trBC) {
      min = trBC;
      points[0] = pointA;
      points[1] = pointB;
      points[2] = pointC;
Severity: Major
Found in src/core/datamatrix/detector/Detector.ts and 1 other location - About 1 hr to fix
src/core/datamatrix/detector/Detector.ts on lines 144..150

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

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 set(x: number /*int*/, y: number /*int*/): void {
        const offset = y * this.rowSize + Math.floor(x / 32);
        this.bits[offset] |= (1 << (x & 0x1f)) & 0xFFFFFFFF;
    }
Severity: Major
Found in src/core/common/BitMatrix.ts and 1 other location - About 1 hr to fix
src/core/common/BitMatrix.ts on lines 209..212

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

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 (min > trCD) {
      min = trCD;
      points[0] = pointB;
      points[1] = pointC;
      points[2] = pointD;
Severity: Major
Found in src/core/datamatrix/detector/Detector.ts and 1 other location - About 1 hr to fix
src/core/datamatrix/detector/Detector.ts on lines 137..143

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

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(other: Object): boolean {
        if (other instanceof ResultPoint) {
            const otherPoint = <ResultPoint>other;
            return this.x === otherPoint.x && this.y === otherPoint.y;
        }
Severity: Major
Found in src/core/ResultPoint.ts and 1 other location - About 1 hr to fix
src/core/Dimension.ts on lines 40..46

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

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 < maxNumEcBytes; ++i) {
            for (const block of blocks) {
                const ecBytes = block.getErrorCorrectionBytes();
                if (i < ecBytes.length) {
                    result.appendBits(ecBytes[i], 8);
Severity: Major
Found in src/core/qrcode/encoder/Encoder.ts and 1 other location - About 1 hr to fix
src/core/qrcode/encoder/Encoder.ts on lines 441..448

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

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 < maxNumDataBytes; ++i) {
            for (const block of blocks) {
                const dataBytes = block.getDataBytes();
                if (i < dataBytes.length) {
                    result.appendBits(dataBytes[i], 8);
Severity: Major
Found in src/core/qrcode/encoder/Encoder.ts and 1 other location - About 1 hr to fix
src/core/qrcode/encoder/Encoder.ts on lines 450..457

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

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

  private readCorner3(numRows: number, numColumns: number): number {
    let currentByte = 0;
    if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
      currentByte |= 1;
    }
Severity: Minor
Found in src/core/datamatrix/decoder/BitMatrixParser.ts - About 1 hr to fix

    Function readUtah has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private readUtah(row: number, column: number, numRows: number, numColumns: number): number {
        let currentByte = 0;
        if (this.readModule(row - 2, column - 2, numRows, numColumns)) {
          currentByte |= 1;
        }
    Severity: Minor
    Found in src/core/datamatrix/decoder/BitMatrixParser.ts - About 1 hr to fix

      Function readCorner1 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private readCorner1(numRows: number, numColumns: number): number {
          let currentByte = 0;
          if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
            currentByte |= 1;
          }
      Severity: Minor
      Found in src/core/datamatrix/decoder/BitMatrixParser.ts - About 1 hr to fix

        Function readCorner4 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private readCorner4(numRows: number, numColumns: number): number {
            let currentByte = 0;
            if (this.readModule(numRows - 3, 0, numRows, numColumns)) {
              currentByte |= 1;
            }
        Severity: Minor
        Found in src/core/datamatrix/decoder/BitMatrixParser.ts - About 1 hr to fix

          Function readCorner2 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private readCorner2(numRows: number, numColumns: number): number {
              let currentByte = 0;
              if (this.readModule(numRows - 3, 0, numRows, numColumns)) {
                currentByte |= 1;
              }
          Severity: Minor
          Found in src/core/datamatrix/decoder/BitMatrixParser.ts - About 1 hr to fix

            Function decodeNumericSegment has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private static decodeNumericSegment(bits: BitSource,
                result: StringBuilder,
                count: number /*int*/): void /*throws FormatException*/ {
                // Read three digits at a time
                while (count >= 3) {
            Severity: Minor
            Found in src/core/qrcode/decoder/DecodedBitStreamParser.ts - About 1 hr to fix

              Function handleEOD has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                handleEOD(context: EncoderContext, buffer: StringBuilder): void {
                  const unwritten = Math.floor((buffer.length() / 3) * 2);
                  const rest = buffer.length() % 3;
              
                  const curCodewordCount = context.getCodewordCount() + unwritten;
              Severity: Minor
              Found in src/core/datamatrix/encoder/C40Encoder.ts - About 1 hr to fix

                Function getEndMode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  getEndMode(): Mode {
                    if (this.mode === Mode.EDF) {
                      if (this.characterLength < 4) {
                        return Mode.ASCII;
                      }
                Severity: Minor
                Found in src/core/datamatrix/encoder/MinimalEncoder.ts - About 1 hr to fix

                  Function encodeMaximal has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    encodeMaximal(context: EncoderContext): void {
                      const buffer = new StringBuilder();
                      let lastCharSize = 0;
                      let backtrackStartPosition = context.pos;
                      let backtrackBufferLength = 0;
                  Severity: Minor
                  Found in src/core/datamatrix/encoder/C40Encoder.ts - About 1 hr to fix

                    Function shiftToModuleCenter has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private shiftToModuleCenter(points: ResultPoint[]): ResultPoint[] {
                        // A..D
                        // |  :
                        // B--C
                        let pointA = points[0];
                    Severity: Minor
                    Found in src/core/datamatrix/detector/Detector.ts - About 1 hr to fix

                      Function getBlackRow has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public getBlackRow(y: number /*int*/, row: BitArray): BitArray /*throws NotFoundException*/ {
                              const source = this.getLuminanceSource();
                              const width = source.getWidth();
                              if (row === undefined || row === null || row.getSize() < width) {
                                  row = new BitArray(width);
                      Severity: Minor
                      Found in src/core/common/GlobalHistogramBinarizer.ts - About 1 hr to fix

                        Function getCornerFromArea has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private getCornerFromArea(left: number, right: number, top: number, bottom: number, maximizeX: boolean, maximizeY: boolean): ResultPoint {
                                let resX = maximizeX ? 0 : Number.MAX_VALUE;
                                let resY = maximizeY ? 0 : Number.MAX_VALUE;
                                for (let x = left; x < right; x++) {
                                    for (let y = top; y < bottom; y++) {
                        Severity: Minor
                        Found in src/core/common/detector/CornerDetector.ts - About 1 hr to fix

                          Function getBullsEyeCorners has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private getBullsEyeCorners(pCenter: Point): ResultPoint[] {
                          
                          
                                  let pina = pCenter;
                                  let pinb = pCenter;
                          Severity: Minor
                          Found in src/core/aztec/detector/Detector.ts - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language