zxing-js/library

View on GitHub

Showing 605 of 958 total issues

Function processFinderPatternInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  protected processFinderPatternInfo(info: FinderPatternInfo): DetectorResult {

    const topLeft: FinderPattern = info.getTopLeft();
    const topRight: FinderPattern = info.getTopRight();
    const bottomLeft: FinderPattern = info.getBottomLeft();
Severity: Minor
Found in src/core/qrcode/detector/Detector.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 applyMaskPenaltyRule3 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static applyMaskPenaltyRule3(matrix: ByteMatrix): number /*int*/ {
        let numPenalties = 0;
        const array: Array<Uint8Array> = matrix.getArray();
        const width: number /*int*/ = matrix.getWidth();
        const height: number /*int*/ = matrix.getHeight();
Severity: Minor
Found in src/core/qrcode/encoder/MaskUtil.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 adjustRowNumbersFromLRI has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  private adjustRowNumbersFromLRI(): int {
    if (this.detectionResultColumns[0] == null) {
      return 0;
    }
    let unadjustedCount: int = 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 findAsteriskPattern has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  private static findAsteriskPattern(row: BitArray, counters: Int32Array): number[] {
    let width = row.getSize();
    let rowOffset = row.getNextSet(0);

    let counterPosition = 0;
Severity: Minor
Found in src/core/oned/Code39Reader.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 adjustRowNumbersFromRRI has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  private adjustRowNumbersFromRRI(): int {
    if (this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {
      return 0;
    }
    let unadjustedCount: int = 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 estimateBlackPoint has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private static estimateBlackPoint(buckets: Int32Array): number /*int*/ /*throws NotFoundException*/ {
        // Find the tallest peak in the histogram.
        const numBuckets = buckets.length;
        let maxBucketCount = 0;
        let firstPeak = 0;
Severity: Minor
Found in src/core/common/GlobalHistogramBinarizer.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 getRowIndicatorColumn has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  private static getRowIndicatorColumn(image: BitMatrix,
    boundingBox: BoundingBox,
    startPoint: ResultPoint,
    leftToRight: boolean,
    minCodewordWidth: 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 recordPattern has a Cognitive Complexity of 13 (exceeds 5 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

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 13 (exceeds 5 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

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 place has 39 lines of code (exceeds 25 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 1 hr to fix

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

      Function findStartPattern has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private static findStartPattern(row: BitArray): Int32Array {
          const width = row.getSize();
          const rowOffset = row.getNextSet(0);
      
              let counterPosition = 0;
      Severity: Minor
      Found in src/core/oned/Code128Reader.ts - About 1 hr to fix

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

          Function getNumberOfC40Words has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static getNumberOfC40Words(
              input: Input,
              from: number,
              c40: boolean,
              characterLength: number[]
          Severity: Minor
          Found in src/core/datamatrix/encoder/MinimalEncoder.ts - About 1 hr to fix

            Function encodeECC200 has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public static encodeECC200(codewords: string, symbolInfo: SymbolInfo) {
                if (codewords.length !== symbolInfo.getDataCapacity()) {
                  throw new Error(
                    'The number of codewords does not match the selected symbol'
                  );
            Severity: Minor
            Found in src/core/datamatrix/encoder/ErrorCorrection.ts - About 1 hr to fix

              Function sizeOfBlackWhiteBlackRun has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private sizeOfBlackWhiteBlackRun(fromX: number /*int*/, fromY: number /*int*/, toX: number /*int*/, toY: number /*int*/): number/*float*/ {
                  // Mild variant of Bresenham's algorithm
                  // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
                  const steep: boolean = Math.abs(toY - fromY) > Math.abs(toX - fromX);
                  if (steep) {
              Severity: Minor
              Found in src/core/qrcode/detector/Detector.ts - About 1 hr to fix

                Function updateStateForChar has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private updateStateForChar(
                    state: State,
                    index: int,
                    result: Collection<State>
                  ): void {
                Severity: Minor
                Found in src/core/aztec/encoder/HighLevelEncoder.ts - About 1 hr to fix

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

                    public encode(): BitArray {
                  
                      const spaceCharCode = StringUtils.getCharCode(' ');
                      const lineBreakCharCode = StringUtils.getCharCode('\n');
                  
                  
                  Severity: Minor
                  Found in src/core/aztec/encoder/HighLevelEncoder.ts - About 1 hr to fix

                    Function parseInformation has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public parseInformation(): string {
                        if (
                          this.getInformation().getSize() <
                          AI01393xDecoder.HEADER_SIZE + AI01decoder.GTIN_SIZE
                        ) {
                    Severity: Minor
                    Found in src/core/oned/rss/expanded/decoders/AI01393xDecoder.ts - About 1 hr to fix

                      Function decodeAnsiX12Segment has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private static decodeAnsiX12Segment(bits: BitSource,
                                                                 result: StringBuilder): void {
                          // Three ANSI X12 values are encoded in a 16-bit value as
                          // (1600 * C1) + (40 * C2) + C3 + 1
                      
                      
                      Severity: Minor
                      Found in src/core/datamatrix/decoder/DecodedBitStreamParser.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language