zxing-js/library

View on GitHub
src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts

Summary

Maintainability
D
1 day
Test Coverage
A
97%

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 removeIncorrectCodewords has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  private removeIncorrectCodewords(codewords: Codeword[], barcodeMetadata: BarcodeMetadata): void {
    // Remove codewords which do not match the metadata
    // TODO Maybe we should keep the incorrect codewords for the start and end positions?
    for (let codewordRow /*int*/ = 0; codewordRow < codewords.length; codewordRow++) {
      let codeword: Codeword = codewords[codewordRow];
Severity: Minor
Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts - About 2 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 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 getBarcodeMetadata has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getBarcodeMetadata(): BarcodeMetadata {
        let codewords: Codeword[] = this.getCodewords();
        let barcodeColumnCount: BarcodeValue = new BarcodeValue();
        let barcodeRowCountUpperPart: BarcodeValue = new BarcodeValue();
        let barcodeRowCountLowerPart: BarcodeValue = new BarcodeValue();
    Severity: Minor
    Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts - About 1 hr to fix

      Function removeIncorrectCodewords has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private removeIncorrectCodewords(codewords: Codeword[], barcodeMetadata: BarcodeMetadata): void {
          // Remove codewords which do not match the metadata
          // TODO Maybe we should keep the incorrect codewords for the start and end positions?
          for (let codewordRow /*int*/ = 0; codewordRow < codewords.length; codewordRow++) {
            let codeword: Codeword = codewords[codewordRow];
      Severity: Minor
      Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts - About 1 hr to fix

        Function adjustIncompleteIndicatorColumnRowNumbers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {
            let boundingBox: BoundingBox = this.getBoundingBox();
            let top: ResultPoint = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
            let bottom: ResultPoint = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
            let firstRow: int = this.imageRowToCodewordIndex(<int> Math.trunc(top.getY()));
        Severity: Minor
        Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts - About 1 hr to fix

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

            private adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {
              let boundingBox: BoundingBox = this.getBoundingBox();
              let top: ResultPoint = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
              let bottom: ResultPoint = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
              let firstRow: int = this.imageRowToCodewordIndex(<int> Math.trunc(top.getY()));
          Severity: Minor
          Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.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

          Consider simplifying this complex logical expression.
          Open

              if ((barcodeColumnCount.getValue().length === 0) ||
                  (barcodeRowCountUpperPart.getValue().length === 0) ||
                  (barcodeRowCountLowerPart.getValue().length === 0) ||
                  (barcodeECLevel.getValue().length === 0) ||
                  barcodeColumnCount.getValue()[0] < 1 ||
          Severity: Major
          Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts - About 1 hr to fix

            Function getBarcodeMetadata has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              getBarcodeMetadata(): BarcodeMetadata {
                let codewords: Codeword[] = this.getCodewords();
                let barcodeColumnCount: BarcodeValue = new BarcodeValue();
                let barcodeRowCountUpperPart: BarcodeValue = new BarcodeValue();
                let barcodeRowCountLowerPart: BarcodeValue = new BarcodeValue();
            Severity: Minor
            Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts - About 45 mins 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 getRowHeights has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              getRowHeights(): Int32Array {
                let barcodeMetadata: BarcodeMetadata = this.getBarcodeMetadata();
                if (barcodeMetadata == null) {
                  return null;
                }
            Severity: Minor
            Found in src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts - About 35 mins 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

            There are no issues that match your filters.

            Category
            Status