zxing-js/library

View on GitHub

Showing 958 of 958 total issues

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 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 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 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 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 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 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 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            multiply(a: number, b: number): number {
              if (a === 0 || b === 0) {
                return 0;
              }
              return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.modulus - 1)];
          Severity: Major
          Found in src/core/pdf417/decoder/ec/ModulusBase.ts and 1 other location - About 1 hr to fix
          src/core/common/reedsolomon/GenericGF.ts on lines 129..136

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  for (let y = 0; y < height; y++) {
                      const outputOffset = y * width;
                      System.arraycopy(this.yuvData, inputOffset, matrix, outputOffset, width);
                      inputOffset += this.dataWidth;
                  }
          Severity: Major
          Found in src/core/PlanarYUVLuminanceSource.ts and 1 other location - About 1 hr to fix
          src/core/RGBLuminanceSource.ts on lines 140..144

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  for (let y = 0; y < height; y++) {
                      const outputOffset = y * width;
                      System.arraycopy(this.luminances, inputOffset, matrix, outputOffset, width);
                      inputOffset += this.dataWidth;
                  }
          Severity: Major
          Found in src/core/RGBLuminanceSource.ts and 1 other location - About 1 hr to fix
          src/core/PlanarYUVLuminanceSource.ts on lines 94..98

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            public multiply(a: number /*int*/, b: number /*int*/): number /*int*/ {
              if (a === 0 || b === 0) {
                return 0;
              }
              return this.expTable[
          Severity: Major
          Found in src/core/common/reedsolomon/GenericGF.ts and 1 other location - About 1 hr to fix
          src/core/pdf417/decoder/ec/ModulusBase.ts on lines 36..41

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 66.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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 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 toGrayscaleBuffer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static toGrayscaleBuffer(imageBuffer: Uint8ClampedArray, width: number, height: number, doAutoInvert: boolean = false): Uint8ClampedArray {
                    const grayscaleBuffer = new Uint8ClampedArray(width * height);
                    HTMLCanvasElementLuminanceSource.FRAME_INDEX = !HTMLCanvasElementLuminanceSource.FRAME_INDEX;
                    if (HTMLCanvasElementLuminanceSource.FRAME_INDEX || !doAutoInvert) {
                      for (let i = 0, j = 0, length = imageBuffer.length; i < length; i += 4, j++) {
              Severity: Minor
              Found in src/browser/HTMLCanvasElementLuminanceSource.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 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 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
                        Severity
                        Category
                        Status
                        Source
                        Language