Showing 605 of 958 total issues
Function decodeAnsiX12Segment
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static decodeAnsiX12Segment(bits: BitSource,
result: StringBuilder): void {
// Three ANSI X12 values are encoded in a 16-bit value as
// (1600 * C1) + (40 * C2) + C3 + 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
Function encode
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public encode(context: EncoderContext): void {
// step C
const buffer = new StringBuilder();
while (context.hasMoreCharacters()) {
const c = context.getCurrentChar();
- 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 a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
let theCounters = this.counters;
theCounters.fill(0);
this.decodeRowResult = '';
- 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 addMissingRows
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
addMissingRows(missingStartRows: int, missingEndRows: int, isLeft: boolean): BoundingBox {
let newTopLeft: ResultPoint = this.topLeft;
let newBottomLeft: ResultPoint = this.bottomLeft;
let newTopRight: ResultPoint = this.topRight;
let newBottomRight: ResultPoint = this.bottomRight;
- 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 getBlackRow
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public getBlackRow(y: number /*int*/, row: BitArray): BitArray /*throws NotFoundException*/ {
const source = this.getLuminanceSource();
const width = source.getWidth();
if (row === undefined || row === null || row.getSize() < width) {
row = new BitArray(width);
- 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 getRSSvalue
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static getRSSvalue(widths: number[], maxWidth: number, noNarrow: boolean): number {
let n = 0;
for (let width of widths) {
n += width;
}
- 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 updateStateForChar
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private updateStateForChar(
state: State,
index: int,
result: Collection<State>
): void {
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
public decode(image: BinaryBitmap, hints?: Map<DecodeHintType, any>): Result {
try {
return this.doDecode(image, hints);
} catch (nfe) {
const tryHarder = hints && (hints.get(DecodeHintType.TRY_HARDER) === 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 getC40Value
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
getC40Value(c40: boolean, setIndex: number, c: number, fnc1: number): number {
if (c === fnc1) {
if (!(setIndex === 2)) {
throw new Error('FNC1 cannot be used in C40 shift 2');
}
Function encodeChar
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
encodeChar(c: char, sb: StringBuilder): number {
if (c === ' '.charCodeAt(0)) {
sb.append(0o3);
return 1;
}
Function calculateBlackPoints
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static calculateBlackPoints(luminances: Uint8ClampedArray,
subWidth: number /*int*/,
subHeight: number /*int*/,
width: number /*int*/,
height: number /*int*/): Int32Array[] {
Consider simplifying this complex logical expression. Open
if (y + 6 < height &&
array[y][x] === 1 &&
array[y + 1][x] === 0 &&
array[y + 2][x] === 1 &&
array[y + 3][x] === 1 &&
Function encode
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static encode(content: string,
ecLevel: ErrorCorrectionLevel,
hints: Map<EncodeHintType, any> = null): QRCode /*throws WriterException*/ {
// Determine what character encoding has been specified by the caller, if any
Consider simplifying this complex logical expression. Open
if (c40) {
return c <= 31
? c
: c === 32
? 3
Consider simplifying this complex logical expression. Open
if (x + 6 < width &&
arrayY[x] === 1 &&
arrayY[x + 1] === 0 &&
arrayY[x + 2] === 1 &&
arrayY[x + 3] === 1 &&
Function parseFromString
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static parseFromString(stringRepresentation: string, setString: string, unsetString: string): BitMatrix {
if (stringRepresentation === null) {
throw new IllegalArgumentException('stringRepresentation cannot be null');
}
Function setHints
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public setHints(hints?: Map<DecodeHintType, any> | null): void {
this.hints = hints;
const tryHarder: boolean = hints !== null && hints !== undefined && undefined !== hints.get(DecodeHintType.TRY_HARDER);
/*@SuppressWarnings("unchecked")*/
Function constructor
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(stringToEncode: string, priorityCharset: Charset, fnc1: number) {
const neededEncoders: CharsetEncoder[] = [];
// we always need the ISO-8859-1 encoder. It is the default encoding
neededEncoders.push(new CharsetEncoder(StandardCharsets.ISO_8859_1));
Function getEncodedData
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static getEncodedData(correctedBits: boolean[]): string {
let endIndex: number = correctedBits.length;
let latchTable = Table.UPPER; // table most recently latched to
let shiftTable = Table.UPPER; // table to use for the next read
let result: string = '';
Function extractPureBits
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static extractPureBits(image: BitMatrix): BitMatrix /*throws NotFoundException */ {
const leftTopBlack: Int32Array = image.getTopLeftOnBit();
const rightBottomBlack: Int32Array = image.getBottomRightOnBit();
if (leftTopBlack === null || rightBottomBlack === null) {