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 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 findGuardPattern
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static findGuardPattern(
row: BitArray,
rowOffset: number,
pattern: Int32Array
): number[] {
Function decodeRow
has a Cognitive Complexity of 10 (exceeds 5 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);
- 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 validateQuietZone
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private validateQuietZone(row: BitArray, startPattern: number): void {
let quietCount: number = this.narrowLineWidth * 10; // expect to find this many pixels of quiet zone
// if there are not so many pixel at all let's try as many as possible
- 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 decodeDigit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static decodeDigit(counters: Int32Array): number {
let bestVariance: number = ITFReader.MAX_AVG_VARIANCE; // worst variance we'll accept
let bestMatch: number = -1;
let max: number = ITFReader.PATTERNS.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"