zxing-js/library

View on GitHub

Showing 605 of 958 total issues

Function adjustOddEvenCounts has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

  private adjustOddEvenCounts(numModules) {
    let oddSum = MathUtils.sum(new Int32Array(this.getOddCounts()));
    let evenSum = MathUtils.sum(new Int32Array(this.getEvenCounts()));

    let incrementOdd = false;
Severity: Minor
Found in src/core/oned/rss/expanded/RSSExpandedReader.ts - About 7 hrs 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 lookAheadTestIntern has 180 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static lookAheadTestIntern(
    msg: string,
    startpos: number,
    currentMode: number
  ): number {
Severity: Major
Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 7 hrs to fix

    Function find has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        public find(): AlignmentPattern /*throws NotFoundException*/ {
            const startX = this.startX;
            const height = this.height;
            const width = this.width;
            const maxJ = startX + width;
    Severity: Minor
    Found in src/core/qrcode/detector/AlignmentPatternFinder.ts - About 7 hrs 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 detect has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        public detect(): ResultPoint[] {
    
            let left = this.leftInit;
            let right = this.rightInit;
            let up = this.upInit;
    Severity: Minor
    Found in src/core/common/detector/CornerDetector.ts - About 6 hrs 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 getEnclosingRectangle has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

        public getEnclosingRectangle(): Int32Array {
            const width = this.width;
            const height = this.height;
            const rowSize = this.rowSize;
            const bits = this.bits;
    Severity: Minor
    Found in src/core/common/BitMatrix.ts - About 6 hrs 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

    File Code128Reader.ts has 430 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2008 ZXing authors
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
    Severity: Minor
    Found in src/core/oned/Code128Reader.ts - About 6 hrs to fix

      File Version.ts has 429 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * Copyright 2007 ZXing authors
       *
       * Licensed under the Apache License, Version 2.0 (the "License");
       * you may not use this file except in compliance with the License.
      Severity: Minor
      Found in src/core/qrcode/decoder/Version.ts - About 6 hrs to fix

        File FinderPatternFinder.ts has 420 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         * Copyright 2007 ZXing authors
         *
         * Licensed under the Apache License, Version 2.0 (the "License");
         * you may not use this file except in compliance with the License.
        Severity: Minor
        Found in src/core/qrcode/detector/FinderPatternFinder.ts - About 6 hrs to fix

          Function decodeExtended has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

            private static decodeExtended(encoded: string): string {
              let length = encoded.length;
              let decoded = '';
              for (let i = 0; i < length; i++) {
                let c = encoded.charAt(i);
          Severity: Minor
          Found in src/core/oned/Code39Reader.ts - About 5 hrs 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 decodeExtended has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

            private decodeExtended(encoded: string): string {
              let length = encoded.length;
              let decoded = '';
              for (let i = 0; i < length; i++) {
                let c = encoded.charAt(i);
          Severity: Minor
          Found in src/core/oned/Code93Reader.ts - About 5 hrs 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

          File HighLevelEncoder.ts has 405 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // tslint:disable-next-line:no-circular-imports
          import { ASCIIEncoder } from './ASCIIEncoder';
          
          // tslint:disable-next-line:no-circular-imports
          import { Base256Encoder } from './Base256Encoder';
          Severity: Minor
          Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 5 hrs to fix

            File Encoder.ts has 405 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * Copyright 2008 ZXing authors
             *
             * Licensed under the Apache License, Version 2.0 (the "License");
             * you may not use this file except in compliance with the License.
            Severity: Minor
            Found in src/core/qrcode/encoder/Encoder.ts - About 5 hrs to fix

              File DecodedBitStreamParser.ts has 404 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import DecoderResult from '../../common/DecoderResult';
              import BitSource from '../../common/BitSource';
              import StringBuilder from '../../util/StringBuilder';
              
              import StringEncoding from '../../util/StringEncoding';
              Severity: Minor
              Found in src/core/datamatrix/decoder/DecodedBitStreamParser.ts - About 5 hrs to fix

                Function decodeTextCompaction has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private static decodeTextCompaction(textCompactionData: Int32Array,
                    byteCompactionData: Int32Array,
                    length: int,
                    result: StringBuilder): void {
                    // Beginning from an initial state of the Alpha sub-mode
                Severity: Major
                Found in src/core/pdf417/decoder/DecodedBitStreamParser.ts - About 5 hrs to fix

                  File PDF417Common.ts has 398 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /*
                  * Copyright 2009 ZXing authors
                  *
                  * Licensed under the Apache License, Version 2.0 (the "License");
                  * you may not use this file except in compliance with the License.
                  Severity: Minor
                  Found in src/core/pdf417/PDF417Common.ts - About 5 hrs to fix

                    Function byteCompaction has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private static /*int*/ byteCompaction(mode: int,
                        codewords: Int32Array,
                        encoding: /*Charset*/ CharacterSetECI,
                        codeIndex: int,
                        result: StringBuilder) {
                    Severity: Minor
                    Found in src/core/pdf417/decoder/DecodedBitStreamParser.ts - About 5 hrs 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 getEncodedData has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static getEncodedData(correctedBits: boolean[]): string {
                            let endIndex: number = correctedBits.length;
                            let latchTable = Table.UPPER; // table most recently latched to
                            let shiftTable = Table.UPPER; // table to use for the next read
                            let result: string = '';
                    Severity: Minor
                    Found in src/core/aztec/decoder/Decoder.ts - About 5 hrs 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

                    File RSS14Reader.ts has 377 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import AbstractRSSReader from './AbstractRSSReader';
                    import Pair from './Pair';
                    import Result from '../../Result';
                    import BitArray from '../../common/BitArray';
                    import DecodeHintType from '../../DecodeHintType';
                    Severity: Minor
                    Found in src/core/oned/rss/RSS14Reader.ts - About 5 hrs to fix

                      File GeneralAppIdDecoder.ts has 373 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import BitArray from '../../../../common/BitArray';
                      import FormatException from '../../../../FormatException';
                      import IllegalStateException from '../../../../IllegalStateException';
                      import StringBuilder from '../../../../util/StringBuilder';
                      import BlockParsedResult from './BlockParsedResult';
                      Severity: Minor
                      Found in src/core/oned/rss/expanded/decoders/GeneralAppIdDecoder.ts - About 4 hrs to fix

                        Function decode has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                        Open

                          public static decode(image: BitMatrix,
                            imageTopLeft: ResultPoint,
                            imageBottomLeft: ResultPoint,
                            imageTopRight: ResultPoint,
                            imageBottomRight: ResultPoint,
                        Severity: Minor
                        Found in src/core/pdf417/decoder/PDF417ScanningDecoder.ts - About 4 hrs 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