zxing-js/library

View on GitHub

Showing 605 of 958 total issues

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

    public decodeMiddle(row: BitArray, startRange: Int32Array, resultString: string) {
        let counters = this.decodeMiddleCounters;
        counters[0] = 0;
        counters[1] = 0;
        counters[2] = 0;
Severity: Minor
Found in src/core/oned/UPCEANExtension5Support.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 decodeRow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {

    // Find out where the Middle section (payload) starts & ends
    let startRange: number[] = this.decodeStart(row);
    let endRange: number[] = this.decodeEnd(row);
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 isValidSequence has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  private static isValidSequence(pairs: Array<ExpandedPair>): boolean {
    for (let sequence of RSSExpandedReader.FINDER_PATTERN_SEQUENCES) {
      if (pairs.length > sequence.length) {
        continue;
      }
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 decodeMiddle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public decodeMiddle(row: BitArray, startRange: Int32Array, resultString: string) {
        let counters = this.decodeMiddleCounters;
        counters[0] = 0;
        counters[1] = 0;
        counters[2] = 0;
Severity: Minor
Found in src/core/oned/UPCEANExtension2Support.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 appendTo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  public appendTo(bitArray: BitArray, text: /*byte[]*/ Uint8Array): void {
    for (let i = 0; i < this.binaryShiftByteCount; i++) {
      if (i === 0 || (i === 31 && this.binaryShiftByteCount <= 62)) {
        // We need a header before the first character, and before
        // character 31 when the total byte code is <= 62
Severity: Minor
Found in src/core/aztec/encoder/BinaryShiftToken.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 parseNumericBlock has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  private parseNumericBlock(): BlockParsedResult {
    while (this.isStillNumeric(this.current.getPosition())) {
      let numeric: DecodedNumeric = this.decodeNumeric(this.current.getPosition());
      this.current.setPosition(numeric.getNewPosition());

Severity: Minor
Found in src/core/oned/rss/expanded/decoders/GeneralAppIdDecoder.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 decodeMiddle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  public decodeMiddle(row: BitArray, startRange: Int32Array, resultString: string) {
        let counters = this.decodeMiddleCounters;
        counters[0] = 0;
        counters[1] = 0;
        counters[2] = 0;
Severity: Minor
Found in src/core/oned/EAN13Reader.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 decodeAlphanumericSegment has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private static decodeAlphanumericSegment(bits: BitSource,
    result: StringBuilder,
    count: number /*int*/,
    fc1InEffect: boolean): void /*throws FormatException*/ {
    // Read two characters at a time
Severity: Minor
Found in src/core/qrcode/decoder/DecodedBitStreamParser.ts - About 1 hr to fix

    Function readFormatInformation has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public readFormatInformation(): FormatInformation /*throws FormatException*/ {
    
            if (this.parsedFormatInfo !== null && this.parsedFormatInfo !== undefined) {
                return this.parsedFormatInfo;
            }
    Severity: Minor
    Found in src/core/qrcode/decoder/BitMatrixParser.ts - About 1 hr to fix

      Function orderBestPatterns has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static orderBestPatterns(patterns: Array<ResultPoint>): void {
      
              // Find distances between pattern centers
              const zeroOneDistance = this.distance(patterns[0], patterns[1]);
              const oneTwoDistance = this.distance(patterns[1], patterns[2]);
      Severity: Minor
      Found in src/core/ResultPoint.ts - About 1 hr to fix

        Function getBlackMatrix has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public getBlackMatrix(): BitMatrix /*throws NotFoundException*/ {
                const source = this.getLuminanceSource();
                const width = source.getWidth();
                const height = source.getHeight();
                const matrix = new BitMatrix(width, height);
        Severity: Minor
        Found in src/core/common/GlobalHistogramBinarizer.ts - About 1 hr to fix

          Function adjustBoundingBox has 27 lines of code (exceeds 25 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

            Function decode has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public decode(received: Int32Array, twoS: number /*int*/): void /*throws ReedSolomonException*/ {
                    const field = this.field;
                    const poly = new GenericGFPoly(field, received);
                    const syndromeCoefficients = new Int32Array(twoS);
                    let noError: boolean = true;
            Severity: Minor
            Found in src/core/common/reedsolomon/ReedSolomonDecoder.ts - About 1 hr to fix

              Function encodeCompressedDate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private encodeCompressedDate(buf: StringBuilder, currentPos: number): void {
                  let numericDate = this.getGeneralDecoder().extractNumericValueFromBitArray(
                    currentPos,
                    AI013x0x1xDecoder.DATE_SIZE
                  );
              Severity: Minor
              Found in src/core/oned/rss/expanded/decoders/AI013x0x1xDecoder.ts - About 1 hr to fix

                Function renderResult has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private renderResult(code: QRCode, width: number /*int*/, height: number /*int*/, quietZone: number /*int*/): SVGSVGElement {
                
                        // if (this.format && format != this.format) {
                        //   throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format)
                        // }
                Severity: Minor
                Found in src/browser/BrowserSvgCodeWriter.ts - About 1 hr to fix

                  Function decodeBase256Segment has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private static decodeBase256Segment(bits: BitSource,
                                                             result: StringBuilder,
                                                             byteSegments: Uint8Array[]): void {
                      // Figure out how long the Base 256 Segment is.
                      let codewordPosition = 1 + bits.getByteOffset(); // position is 1-indexed
                  Severity: Minor
                  Found in src/core/datamatrix/decoder/DecodedBitStreamParser.ts - About 1 hr to fix

                    Function detectCodeword has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private static detectCodeword(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

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

                        public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
                          for (let reader of this.readers) {
                            try {
                              // const result: Result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
                              const result = reader.decodeRow(rowNumber, row, hints);
                      Severity: Minor
                      Found in src/core/oned/MultiFormatUPCEANReader.ts - About 1 hr to fix

                        Function recordPattern has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected static recordPattern(row: BitArray, start: number, counters: Int32Array): void {
                                const numCounters = counters.length;
                                for (let index = 0; index < numCounters; index++)
                                    counters[index] = 0;
                        
                        
                        Severity: Minor
                        Found in src/core/oned/OneDReader.ts - About 1 hr to fix

                          Function getCorrectedParameterData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private getCorrectedParameterData(parameterData: number, compact: boolean): number {
                                  let numCodewords;
                                  let numDataCodewords;
                          
                                  if (compact) {
                          Severity: Minor
                          Found in src/core/aztec/detector/Detector.ts - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language