Showing 605 of 958 total issues
Function readCorner3
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private readCorner3(numRows: number, numColumns: number): number {
let currentByte = 0;
if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1;
}
- 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
switch (cValue) {
case 27: // FNC1
result.append(String.fromCharCode(29)); // translate as ASCII 29
break;
case 30: // Upper Shift
Function textCompaction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static textCompaction(codewords: Int32Array, codeIndex: int, result: StringBuilder): int {
// 2 character per codeword
let textCompactionData: Int32Array = new Int32Array((codewords[0] - codeIndex) * 2);
// Used to hold the byte compaction value if there is a mode shift
let byteCompactionData: Int32Array = new Int32Array((codewords[0] - codeIndex) * 2);
- 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 callback
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function callback(exp: string | number, p0: any, p1: any, p2: any, p3: any, p4: any) {
Function isOnlyDoubleByteKanji
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static isOnlyDoubleByteKanji(content: string): boolean {
let bytes: Uint8Array;
try {
bytes = StringEncoding.encode(content, CharacterSetECI.SJIS); // content.getBytes("Shift_JIS"))
} catch (ignored/*: UnsupportedEncodingException*/) {
- 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 (this.bitMatrix.get(j - col, i)) {
currentByte |= 1;
}
Function findRowSkip
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private findRowSkip(): number /*int*/ {
const max = this.possibleCenters.length;
if (max <= 1) {
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
Avoid deeply nested control flow statements. Open
if (currentState === 2) { // A winner?
if (this.foundPatternCross(stateCount)) { // Yes
const confirmed = this.handlePossibleCenter(stateCount, i, j);
if (confirmed !== null) {
return confirmed;
Function runEuclideanAlgorithm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private runEuclideanAlgorithm(a: ModulusPoly, b: ModulusPoly, R: int): ModulusPoly[] {
// Assume a's degree is >= b's
if (a.getDegree() < b.getDegree()) {
let temp: ModulusPoly = a;
a = b;
- 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 (sjisCurKatakanaWordLength > sjisMaxKatakanaWordLength) {
sjisMaxKatakanaWordLength = sjisCurKatakanaWordLength;
}
Avoid deeply nested control flow statements. Open
} else if (value > 0x7F) {
sjisBytesLeft++;
// sjisDoubleBytesChars++
sjisCurKatakanaWordLength = 0;
sjisCurDoubleBytesWordLength++;
Avoid deeply nested control flow statements. Open
if (pixel < min) {
min = pixel;
}
Function getBlackMatrix
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public getBlackMatrix(): BitMatrix /*throws NotFoundException*/ {
if (this.matrix !== null) {
return this.matrix;
}
const source = this.getLuminanceSource();
- 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 setRange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public setRange(start: number /*int*/, end: number /*int*/): void {
if (end < start || start < 0 || end > this.size) {
throw new IllegalArgumentException();
}
if (end === start) {
- 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 ((value & 0x40) === 0) {
canBeUTF8 = false;
} else {
utf8BytesLeft++;
if ((value & 0x20) === 0) {
Function callback
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function callback(exp: string | number, p0: any, p1: any, p2: any, p3: any, p4: any) {
Avoid deeply nested control flow statements. Open
for (yy++ , offset += width; yy < HybridBinarizer.BLOCK_SIZE; yy++ , offset += width) {
for (let xx = 0; xx < HybridBinarizer.BLOCK_SIZE; xx++) {
sum += luminances[offset + xx] & 0xFF;
}
}
Avoid deeply nested control flow statements. Open
if ((x32 * 32 + bit) < left) {
left = x32 * 32 + bit;
}
Avoid deeply nested control flow statements. Open
while ((theBits >>> bit) === 0) {
bit--;
}
Avoid deeply nested control flow statements. Open
if (rowNumber >= 0) {
if (rowNumber >= barcodeMatrix.length) {
// We have more rows than the barcode metadata allows for, ignore them.
continue;
}