zxing-js/library

View on GitHub

Showing 958 of 958 total issues

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

  private static determineNumSysAndCheckDigit(resultString: StringBuilder, lgPatternFound: int): void {

    for (let numSys: int = 0; numSys <= 1; numSys++) {
      for (let d: int = 0; d < 10; d++) {
        if (lgPatternFound === this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[numSys][d]) {
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 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

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

    static getStandardUPCEANChecksum(s: string): number {
        let length = s.length;
        let sum = 0;
        for (let i = length - 1; i >= 0; i -= 2) {
            let digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);
Severity: Minor
Found in src/core/oned/UPCEANReader.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 decodeDigit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static decodeDigit(counters: Int32Array): number {

    let bestVariance: number = ITFReader.MAX_AVG_VARIANCE; // worst variance we'll accept
    let bestMatch: number = -1;
    let max: number = ITFReader.PATTERNS.length;
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 createDecoder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function createDecoder(information: BitArray): AbstractExpandedDecoder {
  try {
    if (information.get(1)) {
      return new AI01AndOtherAIs(information);

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

export default function createDecoder(information: BitArray): AbstractExpandedDecoder {
  try {
    if (information.get(1)) {
      return new AI01AndOtherAIs(information);

Severity: Minor
Found in src/core/oned/rss/expanded/decoders/createDecoder.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