Showing 605 of 958 total issues
Function encode
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public encode(
contents: string,
format: BarcodeFormat,
width: number,
height: number,
- Read upRead up
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 createECCBlock
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static createECCBlock(codewords: string, numECWords: number): string {
let table = -1;
for (let i = 0; i < FACTOR_SETS.length; i++) {
if (FACTOR_SETS[i] === numECWords) {
table = i;
- Read upRead up
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 decodeAlphanumericSegment
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static decodeAlphanumericSegment(bits: BitSource,
result: StringBuilder,
count: number /*int*/,
fc1InEffect: boolean): void /*throws FormatException*/ {
// Read two characters at a time
- Read upRead up
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 getDataBlocks
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static getDataBlocks(rawCodewords: Uint8Array,
version: Version,
ecLevel: ErrorCorrectionLevel): DataBlock[] {
if (rawCodewords.length !== version.getTotalCodewords()) {
- Read upRead up
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 crossCheckHorizontal
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private crossCheckHorizontal(startJ: number /*int*/, centerI: number /*int*/, maxCount: number /*int*/,
originalStateCountTotal: number /*int*/): number/*float*/ {
const image: BitMatrix = this.image;
const maxJ = image.getWidth();
- Read upRead up
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 crossCheckVertical
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private crossCheckVertical(startI: number /*int*/, centerJ: number /*int*/, maxCount: number /*int*/,
originalStateCountTotal: number /*int*/): number/*float*/ {
const image: BitMatrix = this.image;
const maxI = image.getHeight();
- Read upRead up
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];
- Read upRead up
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 decodeRow2pairs
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
decodeRow2pairs(rowNumber: number, row: BitArray): Array<ExpandedPair> {
let done = false;
while (!done) {
try {
this.pairs.push(this.retrieveNextPair(row, this.pairs, rowNumber));
- Read upRead up
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 decodeRow
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
let theCounters = this.counters;
theCounters.fill(0);
this.decodeRowResult = '';
Function decodeExtended
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static decodeExtended(encoded: string): string {
let length = encoded.length;
let decoded = '';
for (let i = 0; i < length; i++) {
let c = encoded.charAt(i);
Function decodeRow
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
let startGuardRange = UPCEANReader.findStartGuardPattern(row);
let resultPointCallback = hints == null ? null : hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
if (resultPointCallback != null) {
Function decodeAsciiSegment
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static decodeAsciiSegment(bits: BitSource,
result: StringBuilder,
resultTrailer: StringBuilder): Mode {
let upperShift = false;
do {
Function decode
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static decode(image: BitMatrix,
imageTopLeft: ResultPoint,
imageBottomLeft: ResultPoint,
imageTopRight: ResultPoint,
imageBottomRight: ResultPoint,
Function findNextPair
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private findNextPair(
row: BitArray,
previousPairs: Array<ExpandedPair>,
forcedOffset: number
): void {
File Decoder.ts
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright 2010 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
PDF417ResultMetadata
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export default /*public final*/ class PDF417ResultMetadata {
private segmentIndex: /*int*/ number;
private fileId: string;
private lastSegment: boolean;
File Detector.ts
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BitMatrix from '../../common/BitMatrix';
import WhiteRectangleDetector from '../../common/detector/WhiteRectangleDetector';
import DetectorResult from '../../common/DetectorResult';
import GridSamplerInstance from '../../common/GridSamplerInstance';
import NotFoundException from '../../NotFoundException';
Function encodeMinimally
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
encodeMinimally(
stringToEncode: string,
encoderSet: ECIEncoderSet,
fnc1: number
): number[] {
Function getLastASCII
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
getLastASCII(): number {
const length = this.input.length();
const from = this.fromPosition + this.characterLength;
if (length - from > 4 || from >= length) {
return 0;
- Read upRead up
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 handleEOD
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
handleEOD(context: EncoderContext, buffer: StringBuilder): void {
const unwritten = Math.floor((buffer.length() / 3) * 2);
const rest = buffer.length() % 3;
const curCodewordCount = context.getCodewordCount() + unwritten;
- Read upRead up
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"