Showing 605 of 958 total issues
Function crossCheckDiagonal
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private crossCheckDiagonal(startI: number /*int*/, centerJ: number /*int*/, maxCount: number /*int*/, originalStateCountTotal: number /*int*/): boolean {
const stateCount: Int32Array = this.getCrossCheckStateCount();
// Start counting up, left from center finding black center mass
let i = 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 getDataBlocks
has a Cognitive Complexity of 20 (exceeds 5 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();
- 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 createDecoderResultFromAmbiguousValues
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private static createDecoderResultFromAmbiguousValues(ecLevel: int,
codewords: Int32Array,
erasureArray: Int32Array,
ambiguousIndexes: Int32Array,
ambiguousIndexValues: Int32Array[]): DecoderResult {
- 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 20 (exceeds 5 allowed). Consider refactoring. Open
public encode(): BitArray {
const spaceCharCode = StringUtils.getCharCode(' ');
const lineBreakCharCode = StringUtils.getCharCode('\n');
- 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 20 (exceeds 5 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
let startGuardRange = UPCEANReader.findStartGuardPattern(row);
let resultPointCallback = hints == null ? null : hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
if (resultPointCallback != null) {
- 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 correctBits
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private correctBits(rawbits: boolean[]): boolean[] {
let gf: GenericGF;
let codewordSize: number;
if (this.ddata.getNbLayers() <= 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
Consider simplifying this complex logical expression. Open
if (formats !== null && formats !== undefined) {
const addOneDReader: boolean = formats.some(f =>
f === BarcodeFormat.UPC_A ||
f === BarcodeFormat.UPC_E ||
f === BarcodeFormat.EAN_13 ||
BitMatrix
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export default class BitMatrix /*implements Cloneable*/ {
/**
* Creates an empty square {@link BitMatrix}.
*
Function byteCompaction
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static /*int*/ byteCompaction(mode: int,
codewords: Int32Array,
encoding: /*Charset*/ CharacterSetECI,
codeIndex: int,
result: StringBuilder) {
Function encodeLowLevel
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private encodeLowLevel(
placement: DefaultPlacement,
symbolInfo: SymbolInfo,
width: number,
height: number
- 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 handlePossibleCenter
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected handlePossibleCenter(stateCount: Int32Array, i: number /*int*/, j: number /*int*/, pureBarcode: boolean): boolean {
const stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] +
stateCount[4];
let centerJ: number /*float*/ = FinderPatternFinder.centerFromEnd(stateCount, j);
let centerI: number /*float*/ = this.crossCheckVertical(i, /*(int) */Math.floor(centerJ), stateCount[2], stateCountTotal);
- 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 addEdges
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
static addEdges(
input: Input,
edges: Edge[][],
from: number,
previous: Edge
- 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 sizeOfBlackWhiteBlackRun
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private sizeOfBlackWhiteBlackRun(fromX: number /*int*/, fromY: number /*int*/, toX: number /*int*/, toY: number /*int*/): number/*float*/ {
// Mild variant of Bresenham's algorithm
// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
const steep: boolean = Math.abs(toY - fromY) > Math.abs(toX - fromX);
if (steep) {
- 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 buildBitArray
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
static buildBitArray(pairs: Array<ExpandedPair>): BitArray {
let charNumber: number = pairs.length * 2 - 1;
if (pairs[pairs.length - 1].getRightChar() == null) {
charNumber -= 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 constructor
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(solution: Edge) {
const input = solution.input;
let size = 0;
let bytesAL: number[] = [];
const randomizePostfixLength = [];
Function decodeExtended
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
private decodeExtended(encoded: string): string {
let length = encoded.length;
let decoded = '';
for (let i = 0; i < length; i++) {
let c = encoded.charAt(i);
Function buildVersions
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static buildVersions(): Version[] {
return [
new Version(1, 10, 10, 8, 8,
new ECBlocks(5, new ECB(1, 3))),
new Version(2, 12, 12, 10, 10,
Function addEdges
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
static addEdges(
input: Input,
edges: Edge[][],
from: number,
previous: Edge
Function encodeMinimally
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
static encodeMinimally(input: Input): Result {
/* The minimal encoding is computed by Dijkstra. The acyclic graph is modeled as follows:
* A vertex represents a combination of a position in the input and an encoding mode where position 0
* denotes the position left of the first character, 1 the position left of the second character and so on.
* Likewise the end vertices are located after the last character at position input.length().
- 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 applyMaskPenaltyRule1Internal
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static applyMaskPenaltyRule1Internal(matrix: ByteMatrix, isHorizontal: boolean): number /*int*/ {
let penalty = 0;
const iLimit = isHorizontal ? matrix.getHeight() : matrix.getWidth();
const jLimit = isHorizontal ? matrix.getWidth() : matrix.getHeight();
const array: Array<Uint8Array> = matrix.getArray();
- 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"