zxing-js/library

View on GitHub

Showing 605 of 958 total issues

Function getBitCountForCodeword has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static getBitCountForCodeword(codeword: int): Int32Array {
    let result: Int32Array = new Int32Array(8);
    let previousValue: int = 0;
    let i: int = result.length - 1;
    while (true) {
Severity: Minor
Found in src/core/pdf417/decoder/PDF417ScanningDecoder.ts - About 25 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 thresholdBlock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static thresholdBlock(luminances: Uint8ClampedArray,
        xoffset: number /*int*/,
        yoffset: number /*int*/,
        threshold: number /*int*/,
        stride: number /*int*/,
Severity: Minor
Found in src/core/common/HybridBinarizer.ts - About 25 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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public constructor(private width: number /*int*/, private height?: number /*int*/,
        private rowSize?: number /*int*/, private bits?: Int32Array) {
        if (undefined === height || null === height) {
            height = width;
        }
Severity: Minor
Found in src/core/common/BitMatrix.ts - About 25 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 toBytes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public toBytes(bitOffset: number /*int*/, array: Uint8Array, offset: number /*int*/, numBytes: number /*int*/): void {
    for (let i = 0; i < numBytes; i++) {
      let theByte = 0;
      for (let j = 0; j < 8; j++) {
        if (this.get(bitOffset)) {
Severity: Minor
Found in src/core/common/BitArray.ts - About 25 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 verifyCodewordCount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static verifyCodewordCount(codewords: Int32Array, numECCodewords: int): void {
    if (codewords.length < 4) {
      // Codeword array size should be at least 4 allowing for
      // Count CW, At least one Data CW, Error Correction CW, Error Correction CW
      throw FormatException.getFormatInstance();
Severity: Minor
Found in src/core/pdf417/decoder/PDF417ScanningDecoder.ts - About 25 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 findErrorLocations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private findErrorLocations(errorLocator: GenericGFPoly): Int32Array /*throws ReedSolomonException*/ {
        // This is a direct application of Chien's search
        const numErrors = errorLocator.getDegree();
        if (numErrors === 1) { // shortcut
            return Int32Array.from([errorLocator.getCoefficient(1)]);
Severity: Minor
Found in src/core/common/reedsolomon/ReedSolomonDecoder.ts - About 25 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 constructor_1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private constructor_1( image: BitMatrix,
               topLeft: ResultPoint,
               bottomLeft: ResultPoint,
               topRight: ResultPoint,
               bottomRight: ResultPoint)  {
Severity: Minor
Found in src/core/pdf417/decoder/BoundingBox.ts - About 25 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 setRegion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public setRegion(left: number /*int*/, top: number /*int*/, width: number /*int*/, height: number /*int*/): void {
        if (top < 0 || left < 0) {
            throw new IllegalArgumentException('Left and top must be nonnegative');
        }
        if (height < 1 || width < 1) {
Severity: Minor
Found in src/core/common/BitMatrix.ts - About 25 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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public constructor(size?: number /*int*/, bits?: Int32Array) {
    if (undefined === size) {
      this.size = 0;
      this.bits = new Int32Array(1);
    } else {
Severity: Minor
Found in src/core/common/BitArray.ts - About 25 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 multiplyOther has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  multiplyOther(other: ModulusPoly): ModulusPoly {
    if (!this.field.equals(other.field)) {
      throw new IllegalArgumentException('ModulusPolys do not have same ModulusGF field');
    }
    if (this.isZero() || other.isZero()) {
Severity: Minor
Found in src/core/pdf417/decoder/ec/ModulusPoly.ts - About 25 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 parseFromBooleanArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static parseFromBooleanArray(image: boolean[][]): BitMatrix {
        const height = image.length;
        const width = image[0].length;
        const bits = new BitMatrix(width, height);
        for (let i = 0; i < height; i++) {
Severity: Minor
Found in src/core/common/BitMatrix.ts - About 25 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 addEdges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  addEdges(
    stringToEncode: string,
    encoderSet: ECIEncoderSet,
    edges: InputEdge[][],
    from: number,
Severity: Minor
Found in src/core/common/MinimalECIInput.ts - About 25 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 buildToString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private buildToString(setString: string, unsetString: string, lineSeparator: string) {
        let result = new StringBuilder();
        // result.append(lineSeparator);
        for (let y = 0, height = this.height; y < height; y++) {
            for (let x = 0, width = this.width; x < width; x++) {
Severity: Minor
Found in src/core/common/BitMatrix.ts - About 25 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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public constructor(private image: BitMatrix, initSize?: number /*int*/, x?: number /*int*/, y?: number /*int*/) /*throws NotFoundException*/ {
        this.height = image.getHeight();
        this.width = image.getWidth();
        if (undefined === initSize || null === initSize) {
            initSize = WhiteRectangleDetector.INIT_SIZE;
Severity: Minor
Found in src/core/common/detector/WhiteRectangleDetector.ts - About 25 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 multiply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public multiply(other: GenericGFPoly): GenericGFPoly {
        if (!this.field.equals(other.field)) {
            throw new IllegalArgumentException('GenericGFPolys do not have same GenericGF field');
        }
        if (this.isZero() || other.isZero()) {
Severity: Minor
Found in src/core/common/reedsolomon/GenericGFPoly.ts - About 25 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 combins has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static combins(n: number, r: number): number {
    let maxDenom;
    let minDenom;
    if (n - r > r) {
      minDenom = r;
Severity: Minor
Found in src/core/oned/rss/RSSUtils.ts - About 25 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 decodeMiddle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public decodeMiddle(row: BitArray, startRange: Int32Array, result: string) {
    const counters: Int32Array = this.decodeMiddleCounters.map(x => x);
    counters[0] = 0;
    counters[1] = 0;
    counters[2] = 0;
Severity: Minor
Found in src/core/oned/UPCEReader.ts - About 25 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 validateQuietZone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private validateQuietZone(row: BitArray, startPattern: number): void {

    let quietCount: number = this.narrowLineWidth * 10;  // expect to find this many pixels of quiet zone

    // if there are not so many pixel at all let's try as many as possible
Severity: Minor
Found in src/core/oned/ITFReader.ts - About 25 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 bitsToWords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static bitsToWords(stuffedBits: BitArray, wordSize: int, totalWords: int): Int32Array {
    let message: Int32Array = new Int32Array(totalWords);
    let i: int;
    let n: int;
    for (i = 0, n = stuffedBits.getSize() / wordSize; i < n; i++) {
Severity: Minor
Found in src/core/aztec/encoder/Encoder.ts - About 25 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 storeRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private storeRow(rowNumber: number, wasReversed: boolean): void {
    // Discard if duplicate above or below; otherwise insert in order by row number.
    let insertPos = 0;
    let prevIsSame = false;
    let nextIsSame = false;
Severity: Minor
Found in src/core/oned/rss/expanded/RSSExpandedReader.ts - About 25 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

Severity
Category
Status
Source
Language