zxing-js/library

View on GitHub

Showing 958 of 958 total issues

Function embedDataBits has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static embedDataBits(dataBits: BitArray, maskPattern: number /*int*/, matrix: ByteMatrix): void {
        let bitIndex = 0;
        let direction = -1;
        // Start from the right bottom cell.
        let x = matrix.getWidth() - 1;
Severity: Minor
Found in src/core/qrcode/encoder/MatrixUtil.ts - About 1 hr to fix

    Function textCompaction has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private static textCompaction(codewords: Int32Array, codeIndex: int, result: StringBuilder): int {
        // 2 character per codeword
        let textCompactionData: Int32Array = new Int32Array((codewords[0] - codeIndex) * 2);
        // Used to hold the byte compaction value if there is a mode shift
        let byteCompactionData: Int32Array = new Int32Array((codewords[0] - codeIndex) * 2);
    Severity: Minor
    Found in src/core/pdf417/decoder/DecodedBitStreamParser.ts - About 1 hr to fix

      Function findGuardPattern has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private static findGuardPattern( matrix: BitMatrix,
                                               column: /*int*/ number,
                                               row: /*int*/ number,
                                               width: /*int*/ number,
                                               whiteFirst: boolean,
      Severity: Minor
      Found in src/core/pdf417/detector/Detector.ts - About 1 hr to fix

        Function buildBitArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static buildBitArray(pairs: Array<ExpandedPair>): BitArray {
            let charNumber: number = pairs.length * 2 - 1;
            if (pairs[pairs.length - 1].getRightChar() == null) {
              charNumber -= 1;
            }
        Severity: Minor
        Found in src/core/oned/rss/expanded/BitArrayBuilder.ts - About 1 hr to fix

          Function getMatrixCenter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private getMatrixCenter(): Point {
          
                  let pointA: ResultPoint;
                  let pointB: ResultPoint;
                  let pointC: ResultPoint;
          Severity: Minor
          Found in src/core/aztec/detector/Detector.ts - About 1 hr to fix

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

                      case '$':
                        // $A to $Z map to control codes SH to SB
                        if (next >= 'A' && next <= 'Z') {
                          decodedChar = String.fromCharCode(next.charCodeAt(0) - 64);
                        } else {
            Severity: Major
            Found in src/core/oned/Code39Reader.ts and 3 other locations - About 1 hr to fix
            src/core/oned/Code39Reader.ts on lines 273..280
            src/core/oned/Code93Reader.ts on lines 210..217
            src/core/oned/Code93Reader.ts on lines 218..225

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

            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

                      case 'd':
                        // +A to +Z map to a to z
                        if (next >= 'A' && next <= 'Z') {
                          decodedChar = String.fromCharCode(next.charCodeAt(0) + 32);
                        } else {
            Severity: Major
            Found in src/core/oned/Code93Reader.ts and 3 other locations - About 1 hr to fix
            src/core/oned/Code39Reader.ts on lines 273..280
            src/core/oned/Code39Reader.ts on lines 281..288
            src/core/oned/Code93Reader.ts on lines 218..225

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

            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

                      case 'a':
                        // $A to $Z map to control codes SH to SB
                        if (next >= 'A' && next <= 'Z') {
                          decodedChar = String.fromCharCode(next.charCodeAt(0) - 64);
                        } else {
            Severity: Major
            Found in src/core/oned/Code93Reader.ts and 3 other locations - About 1 hr to fix
            src/core/oned/Code39Reader.ts on lines 273..280
            src/core/oned/Code39Reader.ts on lines 281..288
            src/core/oned/Code93Reader.ts on lines 210..217

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

            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

                      case '+':
                        // +A to +Z map to a to z
                        if (next >= 'A' && next <= 'Z') {
                          decodedChar = String.fromCharCode(next.charCodeAt(0) + 32);
                        } else {
            Severity: Major
            Found in src/core/oned/Code39Reader.ts and 3 other locations - About 1 hr to fix
            src/core/oned/Code39Reader.ts on lines 281..288
            src/core/oned/Code93Reader.ts on lines 210..217
            src/core/oned/Code93Reader.ts on lines 218..225

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

            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 (yi < this.width / 2.0) {
                        return [
                            new ResultPoint(ti - CORR, tj + CORR),
                            new ResultPoint(zi + CORR, zj + CORR),
                            new ResultPoint(xi - CORR, xj - CORR),
            Severity: Major
            Found in src/core/common/detector/WhiteRectangleDetector.ts and 1 other location - About 1 hr to fix
            src/core/common/detector/WhiteRectangleDetector.ts on lines 308..314

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

            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

                    try {
                        let detectorResult = detector.detectMirror(false);
                        points = detectorResult.getPoints();
                        this.reportFoundResultPoints(hints, points);
                        decoderResult = new Decoder().decode(detectorResult);
            Severity: Major
            Found in src/core/aztec/AztecReader.ts and 1 other location - About 1 hr to fix
            src/core/aztec/AztecReader.ts on lines 66..76

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

            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

                        try {
                            let detectorResult = detector.detectMirror(true);
                            points = detectorResult.getPoints();
                            this.reportFoundResultPoints(hints, points);
                            decoderResult = new Decoder().decode(detectorResult);
            Severity: Major
            Found in src/core/aztec/AztecReader.ts and 1 other location - About 1 hr to fix
            src/core/aztec/AztecReader.ts on lines 57..64

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

            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 {
                        return [
                            new ResultPoint(ti + CORR, tj + CORR),
                            new ResultPoint(zi + CORR, zj - CORR),
                            new ResultPoint(xi - CORR, xj + CORR),
            Severity: Major
            Found in src/core/common/detector/WhiteRectangleDetector.ts and 1 other location - About 1 hr to fix
            src/core/common/detector/WhiteRectangleDetector.ts on lines 302..308

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

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

              protected processFinderPatternInfo(info: FinderPatternInfo): DetectorResult {
            
                const topLeft: FinderPattern = info.getTopLeft();
                const topRight: FinderPattern = info.getTopRight();
                const bottomLeft: FinderPattern = info.getBottomLeft();
            Severity: Minor
            Found in src/core/qrcode/detector/Detector.ts - About 1 hr to fix

              Function toString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public toString(): string {
                      let result = '';
                      for (let degree = this.getDegree(); degree >= 0; degree--) {
                          let coefficient = this.getCoefficient(degree);
                          if (coefficient !== 0) {
              Severity: Minor
              Found in src/core/common/reedsolomon/AbstractGenericGFPoly.ts - About 1 hr to fix

                Function toString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public toString(): string {
                        let result = '';
                        for (let degree = this.getDegree(); degree >= 0; degree--) {
                            let coefficient = this.getCoefficient(degree);
                            if (coefficient !== 0) {
                Severity: Minor
                Found in src/core/common/reedsolomon/GenericGFPoly.ts - About 1 hr to fix

                  Function decode has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public decode(received: Int32Array,
                      numECCodewords: int,
                      erasures: Int32Array): int {
                  
                      let poly: ModulusPoly = new ModulusPoly(this.field, received);
                  Severity: Minor
                  Found in src/core/pdf417/decoder/ec/ErrorCorrection.ts - About 1 hr to fix

                    Function retrieveNextPair has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      retrieveNextPair(
                        row: BitArray,
                        previousPairs: Array<ExpandedPair>,
                        rowNumber: number
                      ): ExpandedPair {
                    Severity: Minor
                    Found in src/core/oned/rss/expanded/RSSExpandedReader.ts - About 1 hr to fix

                      Function decodeRow2pairs has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        decodeRow2pairs(rowNumber: number, row: BitArray): Array<ExpandedPair> {
                          let done = false;
                          while (!done) {
                            try {
                              this.pairs.push(this.retrieveNextPair(row, this.pairs, rowNumber));
                      Severity: Minor
                      Found in src/core/oned/rss/expanded/RSSExpandedReader.ts - About 1 hr to fix

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

                            public flip(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 193..196

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language