Showing 605 of 958 total issues
Function getMinSymbolSize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
getMinSymbolSize(minimum: number): number {
switch (this.input.getShapeHint()) {
case SymbolShapeHint.FORCE_SQUARE:
for (const capacity of this.squareCodewordCapacities) {
if (capacity >= minimum) {
- 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 findGuardPattern
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static findGuardPattern( matrix: BitMatrix,
column: /*int*/ number,
row: /*int*/ number,
width: /*int*/ number,
whiteFirst: boolean,
- 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 getLatchBytes
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
getLatchBytes(): Uint8Array {
switch (this.getPreviousMode()) {
case Mode.ASCII:
case Mode.B256: // after B256 ends (via length) we are back to ASCII
switch (this.mode) {
Function encode
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public encode(context: EncoderContext) {
const buffer = new StringBuilder();
buffer.append(0o0); // Initialize length field
while (context.hasMoreCharacters()) {
const c = context.getCurrentChar();
Function getEnclosingRectangle
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public getEnclosingRectangle(): Int32Array {
const width = this.width;
const height = this.height;
const rowSize = this.rowSize;
const bits = this.bits;
Function constructor
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(hints?: Map<DecodeHintType, any>) {
super();
const possibleFormats = !hints ? null : <BarcodeFormat[]>hints.get(DecodeHintType.POSSIBLE_FORMATS);
const useCode39CheckDigit = hints && hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) !== undefined;
const useCode39ExtendedMode = hints && hints.get(DecodeHintType.ENABLE_CODE_39_EXTENDED_MODE) !== undefined;
Function estimateBlackPoint
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static estimateBlackPoint(buckets: Int32Array): number /*int*/ /*throws NotFoundException*/ {
// Find the tallest peak in the histogram.
const numBuckets = buckets.length;
let maxBucketCount = 0;
let firstPeak = 0;
Function encodeChar
has 41 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 getDataBlocks
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getDataBlocks(rawCodewords: Int8Array,
version: Version): DataBlock[] {
// Figure out the number and size of data blocks used by this version
const ecBlocks = version.getECBlocks();
Function encodeLowLevel
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private encodeLowLevel(
placement: DefaultPlacement,
symbolInfo: SymbolInfo,
width: number,
height: number
Function crossCheckVertical
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private crossCheckVertical(startI: number /*int*/, centerJ: number /*int*/, maxCount: number /*int*/,
originalStateCountTotal: number /*int*/): number/*float*/ {
const image = this.image;
const maxI = image.getHeight();
Function runEuclideanAlgorithm
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private runEuclideanAlgorithm(a: GenericGFPoly, b: GenericGFPoly, R: number /*int*/): GenericGFPoly[] {
// Assume a's degree is >= b's
if (a.getDegree() < b.getDegree()) {
const temp = a;
a = b;
Function getBarcodeMetadata
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBarcodeMetadata(): BarcodeMetadata {
let codewords: Codeword[] = this.getCodewords();
let barcodeColumnCount: BarcodeValue = new BarcodeValue();
let barcodeRowCountUpperPart: BarcodeValue = new BarcodeValue();
let barcodeRowCountLowerPart: BarcodeValue = new BarcodeValue();
Function decodeRow
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
// Find out where the Middle section (payload) starts & ends
let startRange: number[] = this.decodeStart(row);
let endRange: number[] = this.decodeEnd(row);
Function decode
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decode(image: BinaryBitmap, hints: Map<DecodeHintType, any> | null = null): Result {
let exception: Exception = null;
let detector = new Detector(image.getBlackMatrix());
let points: ResultPoint[] = null;
Function encodeECC200
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static encodeECC200(codewords: string, symbolInfo: SymbolInfo) {
if (codewords.length !== symbolInfo.getDataCapacity()) {
throw new Error(
'The number of codewords does not match the selected symbol'
);
- 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 encodeChar
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
encodeChar(c: char, sb: StringBuilder): number {
if (c === ' '.charCodeAt(0)) {
sb.append(0o3);
return 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 13 (exceeds 5 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
- 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 numericCompaction
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static numericCompaction(codewords: Int32Array, codeIndex: number /*int*/, result: StringBuilder): int {
let count: int = 0;
let end: boolean = false;
let numericCodewords: Int32Array = new Int32Array(DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS);
- 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 processFinderPatternInfo
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected processFinderPatternInfo(info: FinderPatternInfo): DetectorResult {
const topLeft: FinderPattern = info.getTopLeft();
const topRight: FinderPattern = info.getTopRight();
const bottomLeft: FinderPattern = info.getBottomLeft();
- 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"