zxing-js/library

View on GitHub

Showing 605 of 958 total issues

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

    private containsBlackPoint(a: number, b: number, fixed: number, horizontal: boolean): boolean {

        if (horizontal) {
            for (let x = a; x <= b; x++) {
                if (this.image.get(x, fixed)) {
Severity: Minor
Found in src/core/common/detector/CornerDetector.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 readBits has a Cognitive Complexity of 12 (exceeds 5 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

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 findErrorMagnitudes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private findErrorMagnitudes(errorEvaluator: GenericGFPoly, errorLocations: Int32Array): Int32Array {
        // This is directly applying Forney's Formula
        const s = errorLocations.length;
        const result = new Int32Array(s);
        const field = this.field;
Severity: Minor
Found in src/core/common/reedsolomon/ReedSolomonDecoder.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 findAsteriskPattern has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  private findAsteriskPattern(row: BitArray): Int32Array {
    let width = row.getSize();
    let rowOffset = row.getNextSet(0);

    this.counters.fill(0);
Severity: Minor
Found in src/core/oned/Code93Reader.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 findGuardPattern has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private static findGuardPattern(
        row: BitArray,
        rowOffset: number,
        pattern: Int32Array
    ): number[] {
Severity: Minor
Found in src/core/oned/ITFReader.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 decodeOnce has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public decodeOnce(
    element: HTMLVisualMediaElement,
    retryIfNotFound = true,
    retryIfChecksumOrFormatError = true
  ): Promise<Result> {
Severity: Minor
Found in src/browser/BrowserCodeReader.ts - About 1 hr to fix

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

      static decode(bytes:  Uint8Array): DecoderResult {
        const bits = new BitSource(bytes);
        const result = new StringBuilder();
        const resultTrailer = new StringBuilder();
        const byteSegments = new Array<Uint8Array>();
    Severity: Minor
    Found in src/core/datamatrix/decoder/DecodedBitStreamParser.ts - About 1 hr to fix

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

        private convertByteMatrixToBitMatrix(
          matrix: ByteMatrix,
          reqWidth: number,
          reqHeight: number
        ): BitMatrix {
      Severity: Minor
      Found in src/core/datamatrix/DataMatrixWriter.ts - About 1 hr to fix

        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

                  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/GenericGFPoly.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 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

                              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
                                Severity
                                Category
                                Status
                                Source
                                Language