zxing-js/library

View on GitHub

Showing 605 of 958 total issues

Function findRowsWithPattern has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  private static  findRowsWithPattern( matrix: BitMatrix,
                                                    height: /*int*/ number,
                                                    width: /*int*/ number,
                                                    startRow: /*int*/ number,
                                                    startColumn: /*int*/ number,
Severity: Minor
Found in src/core/pdf417/detector/Detector.ts - About 3 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 decodeDataCharacter has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  decodeDataCharacter(
    row: BitArray,
    pattern: FinderPattern,
    isOddPattern: boolean,
    leftChar: boolean
Severity: Major
Found in src/core/oned/rss/expanded/RSSExpandedReader.ts - About 3 hrs to fix

    Function constructor has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      constructor(
        public readonly input: Input,
        public readonly mode: Mode,
        public readonly fromPosition: number,
        public readonly characterLength: number,
    Severity: Minor
    Found in src/core/datamatrix/encoder/MinimalEncoder.ts - About 3 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 readCodewords has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      readCodewords(): Int8Array {
    
        const result = new Int8Array(this.version.getTotalCodewords());
        let resultOffset = 0;
    
    
    Severity: Minor
    Found in src/core/datamatrix/decoder/BitMatrixParser.ts - About 3 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 embedDataBits has a Cognitive Complexity of 24 (exceeds 5 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 3 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 createBarcodeMatrix has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      private static createBarcodeMatrix(detectionResult: DetectionResult): BarcodeValue[][] {
        // let barcodeMatrix: BarcodeValue[][] =
          // new BarcodeValue[detectionResult.getBarcodeRowCount()][detectionResult.getBarcodeColumnCount() + 2];
        let barcodeMatrix: BarcodeValue[][] =
          Array.from({ length: detectionResult.getBarcodeRowCount() }, () => new Array(detectionResult.getBarcodeColumnCount() + 2));
    Severity: Minor
    Found in src/core/pdf417/decoder/PDF417ScanningDecoder.ts - About 3 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 setHints has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        public setHints(hints?: Map<DecodeHintType, any> | null): void {
            this.hints = hints;
    
            const tryHarder: boolean = hints !== null && hints !== undefined && undefined !== hints.get(DecodeHintType.TRY_HARDER);
            /*@SuppressWarnings("unchecked")*/
    Severity: Minor
    Found in src/core/MultiFormatReader.ts - About 3 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 find has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public find(hints: Map<DecodeHintType, any>): FinderPatternInfo /*throws NotFoundException */ {
            const tryHarder: boolean = (hints !== null && hints !== undefined) && undefined !== hints.get(DecodeHintType.TRY_HARDER);
            const pureBarcode: boolean = (hints !== null && hints !== undefined) && undefined !== hints.get(DecodeHintType.PURE_BARCODE);
            const image = this.image;
            const maxI = image.getHeight();
    Severity: Major
    Found in src/core/qrcode/detector/FinderPatternFinder.ts - About 3 hrs to fix

      Function decodeIsoIec646 has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private decodeIsoIec646(pos: number): DecodedChar {
          let fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
          if (fiveBitValue === 15) {
            return new DecodedChar(pos + 5, DecodedChar.FNC1);
          }
      Severity: Major
      Found in src/core/oned/rss/expanded/decoders/GeneralAppIdDecoder.ts - About 3 hrs to fix

        Function constructor has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(
            public readonly input: Input,
            public readonly mode: Mode,
            public readonly fromPosition: number,
            public readonly characterLength: number,
        Severity: Major
        Found in src/core/datamatrix/encoder/MinimalEncoder.ts - About 3 hrs to fix

          Function detect has 82 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public detect(): ResultPoint[] {
          
                  let left = this.leftInit;
                  let right = this.rightInit;
                  let up = this.upInit;
          Severity: Major
          Found in src/core/common/detector/CornerDetector.ts - About 3 hrs to fix

            File BitMatrixParser.ts has 303 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import BitMatrix from '../../common/BitMatrix';
            import Version from './Version';
            
            import FormatException from '../../FormatException';
            import IllegalArgumentException from '../../IllegalArgumentException';
            Severity: Minor
            Found in src/core/datamatrix/decoder/BitMatrixParser.ts - About 3 hrs to fix

              Function place has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                public place(): void {
                  let pos = 0;
                  let row = 4;
                  let col = 0;
              
              
              Severity: Minor
              Found in src/core/datamatrix/encoder/DefaultPlacement.ts - About 3 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 adjustCompleteIndicatorColumnRowNumbers has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                adjustCompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {
                  let codewords: Codeword[] = this.getCodewords();
                  this.setRowNumbers();
                  this.removeIncorrectCodewords(codewords, barcodeMetadata);
                  let boundingBox: BoundingBox = this.getBoundingBox();
              Severity: Minor
              Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts - About 3 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 23 (exceeds 5 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 3 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 getStartColumn has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                private static getStartColumn(detectionResult: DetectionResult,
                  barcodeColumn: int,
                  imageRow: int,
                  leftToRight: boolean): int {
                  let offset: int = leftToRight ? 1 : -1;
              Severity: Minor
              Found in src/core/pdf417/decoder/PDF417ScanningDecoder.ts - About 3 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 decodeTextSegment has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private static decodeTextSegment(bits: BitSource, result: StringBuilder): void {
                  // Three Text values are encoded in a 16-bit value as
                  // (1600 * C1) + (40 * C2) + C3 + 1
                  // TODO(bbrown): The Upper Shift with Text doesn't work in the 4 value scenario all the time
                  let upperShift = false;
              Severity: Major
              Found in src/core/datamatrix/decoder/DecodedBitStreamParser.ts - About 3 hrs to fix

                Function encode has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public encode(
                    contents: string,
                    format: BarcodeFormat,
                    width: number,
                    height: number,
                Severity: Major
                Found in src/core/datamatrix/DataMatrixWriter.ts - About 3 hrs to fix

                  Function decodeDataCharacter has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private decodeDataCharacter(row: BitArray, pattern: FinderPattern, outsideChar: boolean): DataCharacter {
                  
                          let counters = this.getDataCharacterCounters();
                          for (let x = 0; x < counters.length; x++) {
                              counters[x] = 0;
                  Severity: Major
                  Found in src/core/oned/rss/RSS14Reader.ts - About 3 hrs to fix

                    Function constructor has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                      constructor(solution: Edge) {
                        const input = solution.input;
                        let size = 0;
                        let bytesAL: number[] = [];
                        const randomizePostfixLength = [];
                    Severity: Minor
                    Found in src/core/datamatrix/encoder/MinimalEncoder.ts - About 3 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