Showing 605 of 958 total issues
Avoid deeply nested control flow statements. Open
if (maximizeY) {
if (y > resY) {
resY = y;
}
} else {
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
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
Avoid deeply nested control flow statements. Open
if ((value & 0x40) === 0) {
canBeUTF8 = false;
} else {
utf8BytesLeft++;
if ((value & 0x20) === 0) {
Avoid deeply nested control flow statements. Open
if (maximizeX) {
if (x > resX) {
resX = x;
}
} else {
Avoid deeply nested control flow statements. Open
if ((counter * 2) >= totalWideCountersWidth) {
return -1;
}
Function decodeAllCodes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
decodeAllCodes(buff: StringBuilder, initialPosition: number): string {
let currentPosition = initialPosition;
let remaining = null;
do {
let info = this.decodeGeneralPurposeField(currentPosition, remaining);
- 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 (oddSum < evenSum) {
incrementOdd = true;
decrementEven = true;
} else {
decrementOdd = true;
Avoid deeply nested control flow statements. Open
if (shiftUpperMode === upperMode) {
result += String.fromCharCode((code - 64));
} else {
result += String.fromCharCode((code + 64));
}
Function decodeMiddle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public decodeMiddle(row: BitArray, startRange: Int32Array, resultString: string) {
const counters = this.decodeMiddleCounters;
counters[0] = 0;
counters[1] = 0;
counters[2] = 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 parseIsoIec646Block
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private parseIsoIec646Block(): BlockParsedResult {
while (this.isStillIsoIec646(this.current.getPosition())) {
let iso = this.decodeIsoIec646(this.current.getPosition());
this.current.setPosition(iso.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
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
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 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
Function extractParameters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private extractParameters(bullsEyeCorners: ResultPoint[]): void {
if (!this.isValidPoint(bullsEyeCorners[0]) || !this.isValidPoint(bullsEyeCorners[1]) ||
!this.isValidPoint(bullsEyeCorners[2]) || !this.isValidPoint(bullsEyeCorners[3])) {
throw new NotFoundException();
}
- 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;
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';
Avoid deeply nested control flow statements. Open
switch (code) {
case Code128Reader.CODE_FNC_1:
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
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';