zxing-js/library

View on GitHub

Showing 605 of 958 total issues

Function findRowsWithPattern has 48 lines of code (exceeds 25 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 1 hr to fix

    Function doDecode has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private doDecode(image: BinaryBitmap, hints?: Map<DecodeHintType, any>): Result {
            const width = image.getWidth();
            const height = image.getHeight();
            let row = new BitArray(width);
    
    
    Severity: Minor
    Found in src/core/oned/OneDReader.ts - About 1 hr to fix

      Function parseFieldsInGeneralPurpose has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static parseFieldsInGeneralPurpose(rawInformation: string): string {
          if (!rawInformation) {
            return null;
          }
      
      
      Severity: Minor
      Found in src/core/oned/rss/expanded/decoders/FieldParser.ts - About 1 hr to fix

        Function decodeEdifactSegment has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          private static decodeEdifactSegment(bits: BitSource, result: StringBuilder): void {
            do {
              // If there is only two or less bytes left then it will be encoded as ASCII
              if (bits.available() <= 16) {
                return;
        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 crossCheckVertical has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            private crossCheckVertical(startI: number /*int*/, centerJ: number /*int*/, maxCount: number /*int*/,
                originalStateCountTotal: number /*int*/): number/*float*/ {
                const image = this.image;
        
                const maxI = image.getHeight();
        Severity: Minor
        Found in src/core/qrcode/detector/AlignmentPatternFinder.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 decodeNumericSegment has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          private static decodeNumericSegment(bits: BitSource,
            result: StringBuilder,
            count: number /*int*/): void /*throws FormatException*/ {
            // Read three digits at a time
            while (count >= 3) {
        Severity: Minor
        Found in src/core/qrcode/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 findFinderPattern has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            private findFinderPattern(row: BitArray, rightFinderPattern: boolean): number[] {
        
                let counters = this.getDecodeFinderCounters();
                counters[0] = 0;
                counters[1] = 0;
        Severity: Minor
        Found in src/core/oned/rss/RSS14Reader.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 isPartialRow has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          private static isPartialRow(pairs: any, rows: any): boolean {
            for (let r of rows) {
              let allFound = true;
              for (let p of pairs) {
                let found = false;
        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

        Function removePartialRows has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          private removePartialRows(
            pairs: Array<ExpandedPair>,
            rows: Array<ExpandedRow>
          ): void {
            // for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) {
        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

        Function extractBits has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            private extractBits(matrix: BitMatrix): boolean[] {
                let compact = this.ddata.isCompact();
                let layers = this.ddata.getNbLayers();
                let baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
                let alignmentMap = new Int32Array(baseMatrixSize);
        Severity: Minor
        Found in src/core/aztec/decoder/Decoder.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 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public encode(context: EncoderContext): void {
            // step C
            const buffer = new StringBuilder();
            while (context.hasMoreCharacters()) {
              const c = context.getCurrentChar();
        Severity: Minor
        Found in src/core/datamatrix/encoder/C40Encoder.ts - About 1 hr to fix

          Function handleEOD has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private handleEOD(context: EncoderContext, buffer: StringBuilder) {
              try {
                const count = buffer.length();
                if (count === 0) {
                  return; // Already finished
          Severity: Minor
          Found in src/core/datamatrix/encoder/EdifactEncoder.ts - About 1 hr to fix

            Function interleaveWithECBytes has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static interleaveWithECBytes(bits: BitArray,
                    numTotalBytes: number /*int*/,
                    numDataBytes: number /*int*/,
                    numRSBlocks: number /*int*/): BitArray /*throws WriterException*/ {
            
            
            Severity: Minor
            Found in src/core/qrcode/encoder/Encoder.ts - About 1 hr to fix

              Function getDataBlocks has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static getDataBlocks(rawCodewords: Uint8Array,
                      version: Version,
                      ecLevel: ErrorCorrectionLevel): DataBlock[] {
              
                      if (rawCodewords.length !== version.getTotalCodewords()) {
              Severity: Minor
              Found in src/core/qrcode/decoder/DataBlock.ts - About 1 hr to fix

                Function checkAndNudgePoints has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected static checkAndNudgePoints(
                        image: BitMatrix,
                        points: Float32Array
                    ): void /*throws NotFoundException*/ {
                
                
                Severity: Minor
                Found in src/core/common/GridSampler.ts - About 1 hr to fix

                  Function decodeRow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
                  
                      let start = this.findAsteriskPattern(row);
                      // Read off white space
                      let nextStart = row.getNextSet(start[1]);
                  Severity: Minor
                  Found in src/core/oned/Code93Reader.ts - About 1 hr to fix

                    Function default has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function (config) {
                        config.set({
                    
                            basePath: '',
                    
                    
                    Severity: Minor
                    Found in karma.conf.js - About 1 hr to fix

                      Function adjustCompleteIndicatorColumnRowNumbers has 44 lines of code (exceeds 25 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 1 hr to fix

                        Function handleEOD has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          private handleEOD(context: EncoderContext, buffer: StringBuilder) {
                            try {
                              const count = buffer.length();
                              if (count === 0) {
                                return; // Already finished
                        Severity: Minor
                        Found in src/core/datamatrix/encoder/EdifactEncoder.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 toGrayscaleBuffer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static toGrayscaleBuffer(imageBuffer: Uint8ClampedArray, width: number, height: number): Uint8ClampedArray {
                                const grayscaleBuffer = new Uint8ClampedArray(width * height);
                                HTMLCanvasElementLuminanceSource.FRAME_INDEX = !HTMLCanvasElementLuminanceSource.FRAME_INDEX;
                                if(HTMLCanvasElementLuminanceSource.FRAME_INDEX)
                                {
                        Severity: Minor
                        Found in src/browser/HTMLCanvasElementLuminanceSource.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