zxing-js/library

View on GitHub

Showing 605 of 958 total issues

Function parseExtension5String has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static parseExtension5String(raw: string) {
        let currency;
        switch (raw.charAt(0)) {
            case '0':
                currency = '£';
Severity: Minor
Found in src/core/oned/UPCEANExtension5Support.ts - About 1 hr to fix

    Function getLatchBytes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      getLatchBytes(): Uint8Array {
        switch (this.getPreviousMode()) {
          case Mode.ASCII:
          case Mode.B256: // after B256 ends (via length) we are back to ASCII
            switch (this.mode) {
    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 decode has a Cognitive Complexity of 10 (exceeds 5 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

    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 a Cognitive Complexity of 10 (exceeds 5 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

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

      public encode(context: EncoderContext) {
        const buffer = new StringBuilder();
        buffer.append(0o0); // Initialize length field
        while (context.hasMoreCharacters()) {
          const c = context.getCurrentChar();
    Severity: Minor
    Found in src/core/datamatrix/encoder/Base256Encoder.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 readVersion has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public readVersion(): Version /*throws FormatException*/ {
    
            if (this.parsedVersion !== null && this.parsedVersion !== undefined) {
                return this.parsedVersion;
            }
    Severity: Minor
    Found in src/core/qrcode/decoder/BitMatrixParser.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 buildFunctionPattern has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public buildFunctionPattern(): BitMatrix {
            const dimension = this.getDimensionForVersion();
            const bitMatrix = new BitMatrix(dimension);
    
            // Top left finder pattern + separator + format
    Severity: Minor
    Found in src/core/qrcode/decoder/Version.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 terminateBits has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public static terminateBits(numDataBytes: number /*int*/, bits: BitArray): void /*throws WriterException*/ {
            const capacity = numDataBytes * 8;
            if (bits.getSize() > capacity) {
                throw new WriterException('data bits cannot fit in the QR Code' + bits.getSize() + ' > ' +
                    capacity);
    Severity: Minor
    Found in src/core/qrcode/encoder/Encoder.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 adjustIncompleteIndicatorColumnRowNumbers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      private adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {
        let boundingBox: BoundingBox = this.getBoundingBox();
        let top: ResultPoint = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
        let bottom: ResultPoint = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
        let firstRow: int = this.imageRowToCodewordIndex(<int> Math.trunc(top.getY()));
    Severity: Minor
    Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.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 adjustRowNumbersAndGetCount has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      private adjustRowNumbersAndGetCount(): int {
        let unadjustedCount: int = this.adjustRowNumbersByRow();
        if (unadjustedCount === 0) {
          return 0;
        }
    Severity: Minor
    Found in src/core/pdf417/decoder/DetectionResult.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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public constructor(field: AbstractGenericGF, coefficients: Int32Array) {
            if (coefficients.length === 0) {
                throw new IllegalArgumentException();
            }
            this.field = field;
    Severity: Minor
    Found in src/core/common/reedsolomon/GenericGFPoly.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 toString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      public toString(): String {
        let rowIndicatorColumn: DetectionResultColumn = this.detectionResultColumns[0];
        if (rowIndicatorColumn == null) {
          rowIndicatorColumn = this.detectionResultColumns[this.barcodeColumnCount + 1];
        }
    Severity: Minor
    Found in src/core/pdf417/decoder/DetectionResult.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 runEuclideanAlgorithm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private runEuclideanAlgorithm(a: GenericGFPoly, b: GenericGFPoly, R: number /*int*/): GenericGFPoly[] {
            // Assume a's degree is >= b's
            if (a.getDegree() < b.getDegree()) {
                const temp = a;
                a = b;
    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 adjustBoundingBox has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      private static adjustBoundingBox(rowIndicatorColumn: DetectionResultRowIndicatorColumn): BoundingBox {
        if (rowIndicatorColumn == null) {
          return null;
        }
        let rowHeights: Int32Array = rowIndicatorColumn.getRowHeights();
    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 decode has a Cognitive Complexity of 10 (exceeds 5 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

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

      constructor(field: ModulusBase, coefficients: Int32Array) {
        if (coefficients.length === 0) {
          throw new IllegalArgumentException();
        }
        this.field = field;
    Severity: Minor
    Found in src/core/pdf417/decoder/ec/ModulusPoly.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 adjustCodewordStartColumn has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      private static adjustCodewordStartColumn(image: BitMatrix,
        minColumn: int,
        maxColumn: int,
        leftToRight: boolean,
        codewordStartColumn: 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 constructor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public constructor(luminances: Uint8ClampedArray | Int32Array,
            width: number /*int*/,
            height: number /*int*/,
            private dataWidth?: number /*int*/,
            private dataHeight?: number /*int*/,
    Severity: Minor
    Found in src/core/RGBLuminanceSource.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 isFinderPattern has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      protected static isFinderPattern(counters: Int32Array): boolean {
        let firstTwoSum = counters[0] + counters[1];
        let sum = firstTwoSum + counters[2] + counters[3];
        let ratio = firstTwoSum / sum;
        if (ratio >= AbstractRSSReader.MIN_FINDER_PATTERN_RATIO && ratio <= AbstractRSSReader.MAX_FINDER_PATTERN_RATIO) {
    Severity: Minor
    Found in src/core/oned/rss/AbstractRSSReader.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 checkRows has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      private checkRows(
        collectedRows: any,
        currentRow: number
      ): Array<ExpandedPair> {
        for (let i = currentRow; i < this.rows.length; i++) {
    Severity: Minor
    Found in src/core/oned/rss/expanded/RSSExpandedReader.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