Function adjustCompleteIndicatorColumnRowNumbers
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
adjustCompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {
let codewords: Codeword[] = this.getCodewords();
this.setRowNumbers();
this.removeIncorrectCodewords(codewords, barcodeMetadata);
let boundingBox: BoundingBox = this.getBoundingBox();
- 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 removeIncorrectCodewords
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private removeIncorrectCodewords(codewords: Codeword[], barcodeMetadata: BarcodeMetadata): void {
// Remove codewords which do not match the metadata
// TODO Maybe we should keep the incorrect codewords for the start and end positions?
for (let codewordRow /*int*/ = 0; codewordRow < codewords.length; codewordRow++) {
let codeword: Codeword = codewords[codewordRow];
- 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 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 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 removeIncorrectCodewords
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private removeIncorrectCodewords(codewords: Codeword[], barcodeMetadata: BarcodeMetadata): void {
// Remove codewords which do not match the metadata
// TODO Maybe we should keep the incorrect codewords for the start and end positions?
for (let codewordRow /*int*/ = 0; codewordRow < codewords.length; codewordRow++) {
let codeword: Codeword = codewords[codewordRow];
Function adjustIncompleteIndicatorColumnRowNumbers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {
let boundingBox: BoundingBox = this.getBoundingBox();
let top: ResultPoint = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
let bottom: ResultPoint = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
let firstRow: int = this.imageRowToCodewordIndex(<int> Math.trunc(top.getY()));
Function adjustIncompleteIndicatorColumnRowNumbers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {
let boundingBox: BoundingBox = this.getBoundingBox();
let top: ResultPoint = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
let bottom: ResultPoint = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
let firstRow: int = this.imageRowToCodewordIndex(<int> Math.trunc(top.getY()));
- 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 ((barcodeColumnCount.getValue().length === 0) ||
(barcodeRowCountUpperPart.getValue().length === 0) ||
(barcodeRowCountLowerPart.getValue().length === 0) ||
(barcodeECLevel.getValue().length === 0) ||
barcodeColumnCount.getValue()[0] < 1 ||
Function getBarcodeMetadata
has a Cognitive Complexity of 8 (exceeds 5 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();
- 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 getRowHeights
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getRowHeights(): Int32Array {
let barcodeMetadata: BarcodeMetadata = this.getBarcodeMetadata();
if (barcodeMetadata == null) {
return 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"