Showing 605 of 958 total issues
Avoid deeply nested control flow statements. Open
if (oddSum < evenSum) {
incrementOdd = true;
decrementEven = true;
} else {
decrementOdd = true;
Function isAlphaTo646ToAlphaLatch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private isAlphaTo646ToAlphaLatch(pos: number): boolean {
if (pos + 1 > this.information.getSize()) {
return false;
}
- 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 retrieveNextPair
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
retrieveNextPair(
row: BitArray,
previousPairs: Array<ExpandedPair>,
rowNumber: number
): ExpandedPair {
- 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
Avoid deeply nested control flow statements. Open
if (!upperMode && shiftUpperMode) {
upperMode = true;
shiftUpperMode = false;
} else if (upperMode && shiftUpperMode) {
upperMode = false;
Function getValidRowData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private getValidRowData(row: BitArray): any {
let booleanArr = row.toArray();
let startIndex = booleanArr.indexOf(true);
if (startIndex === -1) return null;
let lastIndex = booleanArr.lastIndexOf(true);
- 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
Avoid deeply nested control flow statements. Open
if (evenParityBad) {
throw new NotFoundException();
}
Avoid deeply nested control flow statements. Open
if (code !== Code128Reader.CODE_STOP) {
lastCharacterWasPrintable = false;
}
Avoid deeply nested control flow statements. Open
if (convertFNC1) {
if (result.length === 0) {
// GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
// is FNC1 then this is GS1-128. We add the symbology identifier.
result += ']C1';
Function getStandardUPCEANChecksum
has a Cognitive Complexity of 8 (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);
- 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 parseAlphaBlock
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private parseAlphaBlock(): BlockParsedResult {
while (this.isStillAlpha(this.current.getPosition())) {
let alpha = this.decodeAlphanumeric(this.current.getPosition());
this.current.setPosition(alpha.getNewPosition());
- 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
Consider simplifying this complex logical expression. Open
} else if ((row === numRows - 2) && (column === 0) && ((numColumns & 0x07) === 4) && !corner4Read) {
result[resultOffset++] = this.readCorner4(numRows, numColumns) & 0xff;
row -= 2;
column += 2;
corner4Read = true;
Consider simplifying this complex logical expression. Open
if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) {
const maxSize = right - left;
let z: ResultPoint | null = null;
Function encodeChar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
encodeChar(c: char, sb: StringBuilder): number {
switch (c) {
case 13: // CR (Carriage return)
sb.append(0o0);
break;
- 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 getShiftValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getShiftValue(c: number, c40: boolean, fnc1: number): number {
return (c40 && MinimalEncoder.isInC40Shift1Set(c)) ||
(!c40 && MinimalEncoder.isInTextShift1Set(c))
? 0
: (c40 && MinimalEncoder.isInC40Shift2Set(c, fnc1)) ||
- 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 renderResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private renderResult(code: QRCode, width: number /*int*/, height: number /*int*/, quietZone: number /*int*/): SVGSVGElement {
const input = code.getMatrix();
if (input === null) {
- 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 renderResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private renderResult(code: QRCode, width: number /*int*/, height: number /*int*/, quietZone: number /*int*/): SVGSVGElement {
// if (this.format && format != this.format) {
// throw new IllegalArgumentException("Can only encode QR_CODE, but got " + format)
// }
- 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 getDataBytes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getDataBytes(): Uint8Array {
switch (this.mode) {
case Mode.ASCII:
if (this.input.isECI(this.fromPosition)) {
return Edge.getBytes(
- 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 decodeContinuously
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public decodeContinuously(
element: HTMLVideoElement,
callbackFn: DecodeContinuouslyCallback
): void {
this._stopContinuousDecode = false;
- 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 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)) {
- 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 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());
- 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"