zxing-js/library

View on GitHub

Showing 958 of 958 total issues

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

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