Showing 605 of 958 total issues
Function findRowsWithPattern
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static findRowsWithPattern( matrix: BitMatrix,
height: /*int*/ number,
width: /*int*/ number,
startRow: /*int*/ number,
startColumn: /*int*/ number,
Function doDecode
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private doDecode(image: BinaryBitmap, hints?: Map<DecodeHintType, any>): Result {
const width = image.getWidth();
const height = image.getHeight();
let row = new BitArray(width);
Function parseFieldsInGeneralPurpose
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
static parseFieldsInGeneralPurpose(rawInformation: string): string {
if (!rawInformation) {
return null;
}
Function toGrayscaleBuffer
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static toGrayscaleBuffer(imageBuffer: Uint8ClampedArray, width: number, height: number, doAutoInvert: boolean = false): Uint8ClampedArray {
const grayscaleBuffer = new Uint8ClampedArray(width * height);
HTMLCanvasElementLuminanceSource.FRAME_INDEX = !HTMLCanvasElementLuminanceSource.FRAME_INDEX;
if (HTMLCanvasElementLuminanceSource.FRAME_INDEX || !doAutoInvert) {
for (let i = 0, j = 0, length = imageBuffer.length; i < length; i += 4, j++) {
- 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 decodeNumericSegment
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static decodeNumericSegment(bits: BitSource,
result: StringBuilder,
count: number /*int*/): void /*throws FormatException*/ {
// Read three digits at a time
while (count >= 3) {
- 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 decodeEdifactSegment
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static decodeEdifactSegment(bits: BitSource, result: StringBuilder): void {
do {
// If there is only two or less bytes left then it will be encoded as ASCII
if (bits.available() <= 16) {
return;
- 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 crossCheckVertical
has a Cognitive Complexity of 15 (exceeds 5 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();
- 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 extractBits
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private extractBits(matrix: BitMatrix): boolean[] {
let compact = this.ddata.isCompact();
let layers = this.ddata.getNbLayers();
let baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
let alignmentMap = new Int32Array(baseMatrixSize);
- 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 isPartialRow
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static isPartialRow(pairs: any, rows: any): boolean {
for (let r of rows) {
let allFound = true;
for (let p of pairs) {
let found = 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 findFinderPattern
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private findFinderPattern(row: BitArray, rightFinderPattern: boolean): number[] {
let counters = this.getDecodeFinderCounters();
counters[0] = 0;
counters[1] = 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 removePartialRows
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private removePartialRows(
pairs: Array<ExpandedPair>,
rows: Array<ExpandedRow>
): void {
// for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) {
- 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 handleEOD
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleEOD(context: EncoderContext, buffer: StringBuilder) {
try {
const count = buffer.length();
if (count === 0) {
return; // Already finished
Function interleaveWithECBytes
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static interleaveWithECBytes(bits: BitArray,
numTotalBytes: number /*int*/,
numDataBytes: number /*int*/,
numRSBlocks: number /*int*/): BitArray /*throws WriterException*/ {
Function encode
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public encode(context: EncoderContext): void {
// step C
const buffer = new StringBuilder();
while (context.hasMoreCharacters()) {
const c = context.getCurrentChar();
Function getDataBlocks
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static getDataBlocks(rawCodewords: Uint8Array,
version: Version,
ecLevel: ErrorCorrectionLevel): DataBlock[] {
if (rawCodewords.length !== version.getTotalCodewords()) {
Function checkAndNudgePoints
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static checkAndNudgePoints(
image: BitMatrix,
points: Float32Array
): void /*throws NotFoundException*/ {
Function decodeRow
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
let start = this.findAsteriskPattern(row);
// Read off white space
let nextStart = row.getNextSet(start[1]);
Function default
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function (config) {
config.set({
basePath: '',
Function adjustCompleteIndicatorColumnRowNumbers
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
adjustCompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {
let codewords: Codeword[] = this.getCodewords();
this.setRowNumbers();
this.removeIncorrectCodewords(codewords, barcodeMetadata);
let boundingBox: BoundingBox = this.getBoundingBox();
Function handleEOD
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private handleEOD(context: EncoderContext, buffer: StringBuilder) {
try {
const count = buffer.length();
if (count === 0) {
return; // Already finished
- 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"