zxing-js/library

View on GitHub

Showing 605 of 958 total issues

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