Showing 605 of 958 total issues
Function findErrorMagnitudes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private findErrorMagnitudes(errorEvaluator: GenericGFPoly, errorLocations: Int32Array): Int32Array {
// This is directly applying Forney's Formula
const s = errorLocations.length;
const result = new Int32Array(s);
const field = this.field;
- 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 getModuleBitCount
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static getModuleBitCount(image: BitMatrix,
minColumn: int,
maxColumn: int,
leftToRight: boolean,
startColumn: int,
- 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 isRange
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public isRange(start: number /*int*/, end: number /*int*/, value: boolean): boolean {
if (end < start || start < 0 || end > this.size) {
throw new IllegalArgumentException();
}
if (end === start) {
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
private static findGuardPattern(
row: BitArray,
rowOffset: number,
pattern: Int32Array
): 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 findAsteriskPattern
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private findAsteriskPattern(row: BitArray): Int32Array {
let width = row.getSize();
let rowOffset = row.getNextSet(0);
this.counters.fill(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 decode
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
static decode(bytes: Uint8Array): DecoderResult {
const bits = new BitSource(bytes);
const result = new StringBuilder();
const resultTrailer = new StringBuilder();
const byteSegments = new Array<Uint8Array>();
Function decodeOnce
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decodeOnce(
element: HTMLVisualMediaElement,
retryIfNotFound = true,
retryIfChecksumOrFormatError = true
): Promise<Result> {
Function convertByteMatrixToBitMatrix
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private convertByteMatrixToBitMatrix(
matrix: ByteMatrix,
reqWidth: number,
reqHeight: number
): BitMatrix {
Function embedDataBits
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static embedDataBits(dataBits: BitArray, maskPattern: number /*int*/, matrix: ByteMatrix): void {
let bitIndex = 0;
let direction = -1;
// Start from the right bottom cell.
let x = matrix.getWidth() - 1;
Function textCompaction
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static textCompaction(codewords: Int32Array, codeIndex: int, result: StringBuilder): int {
// 2 character per codeword
let textCompactionData: Int32Array = new Int32Array((codewords[0] - codeIndex) * 2);
// Used to hold the byte compaction value if there is a mode shift
let byteCompactionData: Int32Array = new Int32Array((codewords[0] - codeIndex) * 2);
Function findGuardPattern
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static findGuardPattern( matrix: BitMatrix,
column: /*int*/ number,
row: /*int*/ number,
width: /*int*/ number,
whiteFirst: boolean,
Function buildBitArray
has 35 lines of code (exceeds 25 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;
}
Function getMatrixCenter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getMatrixCenter(): Point {
let pointA: ResultPoint;
let pointB: ResultPoint;
let pointC: ResultPoint;
Function processFinderPatternInfo
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected processFinderPatternInfo(info: FinderPatternInfo): DetectorResult {
const topLeft: FinderPattern = info.getTopLeft();
const topRight: FinderPattern = info.getTopRight();
const bottomLeft: FinderPattern = info.getBottomLeft();
Function toString
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public toString(): string {
let result = '';
for (let degree = this.getDegree(); degree >= 0; degree--) {
let coefficient = this.getCoefficient(degree);
if (coefficient !== 0) {
Function toString
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public toString(): string {
let result = '';
for (let degree = this.getDegree(); degree >= 0; degree--) {
let coefficient = this.getCoefficient(degree);
if (coefficient !== 0) {
Function decode
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decode(received: Int32Array,
numECCodewords: int,
erasures: Int32Array): int {
let poly: ModulusPoly = new ModulusPoly(this.field, received);
Function retrieveNextPair
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
retrieveNextPair(
row: BitArray,
previousPairs: Array<ExpandedPair>,
rowNumber: number
): ExpandedPair {
Function decodeRow2pairs
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
decodeRow2pairs(rowNumber: number, row: BitArray): Array<ExpandedPair> {
let done = false;
while (!done) {
try {
this.pairs.push(this.retrieveNextPair(row, this.pairs, rowNumber));
Function readCorner3
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private readCorner3(numRows: number, numColumns: number): number {
let currentByte = 0;
if (this.readModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1;
}