zxing-js/library

View on GitHub

Showing 605 of 958 total issues

Function decode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  static decode(codewords: Int32Array, ecLevel: string): DecoderResult {
    // pass encoding to result (will be used for decode symbols in byte mode)
    let result: StringBuilder = new StringBuilder('');
    // let encoding: Charset = StandardCharsets.ISO_8859_1;
    let encoding = CharacterSetECI.ISO8859_1;
Severity: Minor
Found in src/core/pdf417/decoder/DecodedBitStreamParser.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

Function renderResult has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static renderResult(code: QRCode, width: number /*int*/, height: number /*int*/, quietZone: number /*int*/): BitMatrix {
        const input = code.getMatrix();
        if (input === null) {
            throw new IllegalStateException();
        }
Severity: Minor
Found in src/core/qrcode/QRCodeWriter.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

Function applyMaskPenaltyRule2 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static applyMaskPenaltyRule2(matrix: ByteMatrix): number /*int*/ {
        let penalty = 0;
        const array: Array<Uint8Array> = matrix.getArray();
        const width: number /*int*/ = matrix.getWidth();
        const height: number /*int*/ = matrix.getHeight();
Severity: Minor
Found in src/core/qrcode/encoder/MaskUtil.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

Function decodeFallback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static decodeFallback(bytes: Uint8Array, encoding: string | CharacterSetECI): string {

    const characterSet = this.encodingCharacterSet(encoding);

    if (StringEncoding.isDecodeFallbackSupported(characterSet)) {
Severity: Minor
Found in src/core/util/StringEncoding.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

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

Function readFormatInformation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public readFormatInformation(): FormatInformation /*throws FormatException*/ {

        if (this.parsedFormatInfo !== null && this.parsedFormatInfo !== undefined) {
            return this.parsedFormatInfo;
        }
Severity: Minor
Found in src/core/qrcode/decoder/BitMatrixParser.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

Function decode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public decode(image: BinaryBitmap, hints?: Map<DecodeHintType, any>): Result {
    let decoderResult: DecoderResult;
    let points: Array<ResultPoint>;
    if (hints !== undefined && hints !== null && undefined !== hints.get(DecodeHintType.PURE_BARCODE)) {
      const bits = QRCodeReader.extractPureBits(image.getBlackMatrix());
Severity: Minor
Found in src/core/qrcode/QRCodeReader.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

Function detectCodeword has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static detectCodeword(image: BitMatrix,
    minColumn: int,
    maxColumn: int,
    leftToRight: boolean,
    startColumn: int,
Severity: Minor
Found in src/core/pdf417/decoder/PDF417ScanningDecoder.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

Function patternMatchVariance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static patternMatchVariance( counters: Int32Array,  pattern: Int32Array,  maxIndividualVariance: float): float {
    let numCounters = counters.length;
    let total = 0;
    let patternLength = 0;
    for (let i = 0; i < numCounters; i++) {
Severity: Minor
Found in src/core/pdf417/detector/Detector.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

Function decodeInternal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private decodeInternal(image: BinaryBitmap): Result {

        if (this.readers === null) {
            throw new ReaderException('No readers where selected, nothing can be read.');
        }
Severity: Minor
Found in src/core/MultiFormatReader.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

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

  private static getBarcodeMetadata(leftRowIndicatorColumn: DetectionResultRowIndicatorColumn,
    rightRowIndicatorColumn: DetectionResultRowIndicatorColumn): BarcodeMetadata {
    let leftBarcodeMetadata: BarcodeMetadata;
    if (leftRowIndicatorColumn == null ||
      (leftBarcodeMetadata = leftRowIndicatorColumn.getBarcodeMetadata()) == null) {
Severity: Minor
Found in src/core/pdf417/decoder/PDF417ScanningDecoder.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

Function toString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public static toString(barcodeMatrix: BarcodeValue[][]): String {
    let formatter = new Formatter();
    // try (let formatter = new Formatter()) {
    for (let row /*int*/ = 0; row < barcodeMatrix.length; row++) {
      formatter.format('Row %2d: ', row);
Severity: Minor
Found in src/core/pdf417/decoder/PDF417ScanningDecoder.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

Function decode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public decode(received: Int32Array, twoS: number /*int*/): void /*throws ReedSolomonException*/ {
        const field = this.field;
        const poly = new GenericGFPoly(field, received);
        const syndromeCoefficients = new Int32Array(twoS);
        let noError: boolean = true;
Severity: Minor
Found in src/core/common/reedsolomon/ReedSolomonDecoder.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

Function constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(stringToEncode: string, priorityCharset: Charset, fnc1: number) {
    this.fnc1 = fnc1;
    const encoderSet = new ECIEncoderSet(stringToEncode, priorityCharset, fnc1);

    if (encoderSet.length() === 1) {
Severity: Minor
Found in src/core/common/MinimalECIInput.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

Function patternMatchVariance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected static patternMatchVariance(counters: Int32Array, pattern: Int32Array, maxIndividualVariance: number): number {
        const numCounters = counters.length;
        let total = 0;
        let patternLength = 0;
        for (let i = 0; i < numCounters; i++) {
Severity: Minor
Found in src/core/oned/OneDReader.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

Function addBinaryShiftChar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  addBinaryShiftChar(index: int): State {
    let token: Token = this.token;
    let mode: int = this.mode;
    let bitCount: int = this.bitCount;
    if (this.mode === C.MODE_PUNCT || this.mode === C.MODE_DIGIT) {
Severity: Minor
Found in src/core/aztec/encoder/State.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

Function codaBarDecodeRow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private codaBarDecodeRow(row: Array<number>): string {
        const code = [];
        const barThreshold = Math.ceil(
            row.reduce((pre, item) => (pre + item) / 2, 0)
        );
Severity: Minor
Found in src/core/oned/CodaBarReader.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

Function static_CHAR_MAP has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function static_CHAR_MAP(CHAR_MAP: Int32Array[]): Int32Array[] {
  const spaceCharCode = StringUtils.getCharCode(' ');
  const pointCharCode = StringUtils.getCharCode('.');
  const commaCharCode = StringUtils.getCharCode(',');

Severity: Minor
Found in src/core/aztec/encoder/CharMap.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

Function encodeWithHints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public encodeWithHints(contents: string, format: BarcodeFormat, width: int, height: int, hints: Map<EncodeHintType, any>): BitMatrix {
    let charset: Charset = StandardCharsets.ISO_8859_1;
    let eccPercent: int = Encoder.DEFAULT_EC_PERCENT;
    let layers: int = Encoder.DEFAULT_AZTEC_LAYERS;
    if (hints != null) {
Severity: Minor
Found in src/core/aztec/AztecWriter.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

Function renderResult has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static renderResult(code: AztecCode, width: int, height: int): BitMatrix {
    let input: BitMatrix = code.getMatrix();
    if (input == null) {
      throw new IllegalStateException();
    }
Severity: Minor
Found in src/core/aztec/AztecWriter.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

Severity
Category
Status
Source
Language