zxing-js/library

View on GitHub

Showing 605 of 958 total issues

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

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

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

                    private static toNarrowWidePattern(counters: Int32Array): number {
                      let numCounters = counters.length;
                      let maxNarrowCounter = 0;
                      let wideCounters: number;
                      do {
                  Severity: Minor
                  Found in src/core/oned/Code39Reader.ts - About 1 hr 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 getEndMode has a Cognitive Complexity of 12 (exceeds 5 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

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

                        private selectBestPatterns(): FinderPattern[] /*throws NotFoundException */ {
                    
                            const startSize = this.possibleCenters.length;
                            if (startSize < 3) {
                                // Couldn't find enough finder patterns
                    Severity: Minor
                    Found in src/core/qrcode/detector/FinderPatternFinder.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 doDecodeFormatInformation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static doDecodeFormatInformation(maskedFormatInfo1: number /*int*/, maskedFormatInfo2: number /*int*/): FormatInformation {
                            // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
                            let bestDifference = Number.MAX_SAFE_INTEGER;
                            let bestFormatInfo = 0;
                            for (const decodeInfo of FormatInformation.FORMAT_INFO_DECODE_LOOKUP) {
                    Severity: Minor
                    Found in src/core/qrcode/decoder/FormatInformation.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 getClosestDecodedValue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private static getClosestDecodedValue(moduleBitCount: Int32Array): int {
                        let bitCountSum: int = MathUtils.sum(moduleBitCount);
                        let bitCountRatios: float[] = new Array(PDF417Common.BARS_IN_MODULE);
                        if (bitCountSum > 1) {
                          for (let /*int*/ i = 0; i < bitCountRatios.length; i++) {
                    Severity: Minor
                    Found in src/core/pdf417/decoder/PDF417CodewordDecoder.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 decodeMacroBlock has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      static decodeMacroBlock(codewords: Int32Array, codeIndex: int, resultMetadata: PDF417ResultMetadata): int {
                        if (codeIndex + DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {
                          // we must have at least two bytes left for the segment index
                          throw FormatException.getFormatInstance();
                        }
                    Severity: Minor
                    Found in src/core/pdf417/decoder/DecodedBitStreamParser.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 isRange has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public isRange(start: number /*int*/, end: number /*int*/, value: boolean): boolean {
                        if (end < start || start < 0 || end > this.size) {
                          throw new IllegalArgumentException();
                        }
                        if (end === start) {
                    Severity: Minor
                    Found in src/core/common/BitArray.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 containsBlackPoint has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private containsBlackPoint(a: number /*int*/, b: number /*int*/, fixed: number /*int*/, horizontal: boolean): boolean {
                    
                            const image = this.image;
                    
                            if (horizontal) {
                    Severity: Minor
                    Found in src/core/common/detector/WhiteRectangleDetector.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 getModuleBitCount has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private static getModuleBitCount(image: BitMatrix,
                        minColumn: int,
                        maxColumn: int,
                        leftToRight: boolean,
                        startColumn: int,
                    Severity: Minor
                    Found in src/core/pdf417/decoder/PDF417ScanningDecoder.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 sampleGridWithTransform has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public sampleGridWithTransform(image: BitMatrix,
                            dimensionX: number /*int*/,
                            dimensionY: number /*int*/,
                            transform: PerspectiveTransform): BitMatrix /*throws NotFoundException*/ {
                            if (dimensionX <= 0 || dimensionY <= 0) {
                    Severity: Minor
                    Found in src/core/common/DefaultGridSampler.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 getCodewordNearby has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        /*final*/  getCodewordNearby(imageRow: int): Codeword {
                            let codeword = this.getCodeword(imageRow);
                            if (codeword != null) {
                                return codeword;
                            }
                    Severity: Minor
                    Found in src/core/pdf417/decoder/DetectionResultColumn.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

                    Severity
                    Category
                    Status
                    Source
                    Language