Showing 958 of 958 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
public rotateCounterClockwise45(): BinaryBitmap {
const newSource: LuminanceSource = this.binarizer.getLuminanceSource().rotateCounterClockwise45();
return new BinaryBitmap(this.binarizer.createBinarizer(newSource));
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
private distancePoint(a: Point, b: Point): number {
return MathUtils.distance(a.getX(), a.getY(), b.getX(), b.getY());
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function toGrayscaleBuffer
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static toGrayscaleBuffer(imageBuffer: Uint8ClampedArray, width: number, height: number): Uint8ClampedArray {
const grayscaleBuffer = new Uint8ClampedArray(width * height);
HTMLCanvasElementLuminanceSource.FRAME_INDEX = !HTMLCanvasElementLuminanceSource.FRAME_INDEX;
if(HTMLCanvasElementLuminanceSource.FRAME_INDEX)
{
Function encodeChar
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
encodeChar(c: char, sb: StringBuilder): number {
if (c === ' '.charCodeAt(0)) {
sb.append(0o3);
return 1;
}
Function getDataBlocks
has 41 lines of code (exceeds 25 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();
Function encodeLowLevel
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private encodeLowLevel(
placement: DefaultPlacement,
symbolInfo: SymbolInfo,
width: number,
height: number
Function crossCheckVertical
has 41 lines of code (exceeds 25 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();
Function runEuclideanAlgorithm
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private runEuclideanAlgorithm(a: GenericGFPoly, b: GenericGFPoly, R: number /*int*/): GenericGFPoly[] {
// Assume a's degree is >= b's
if (a.getDegree() < b.getDegree()) {
const temp = a;
a = b;
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 decode
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decode(image: BinaryBitmap, hints: Map<DecodeHintType, any> | null = null): Result {
let exception: Exception = null;
let detector = new Detector(image.getBlackMatrix());
let points: ResultPoint[] = null;
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);
Similar blocks of code found in 2 locations. Consider refactoring. Open
for (let i = 5; i >= 0; i--) {
for (let j = dimension - 9; j >= ijMin; j--) {
versionBits = this.copyBit(i, j, versionBits);
}
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 67.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
for (let j = 5; j >= 0; j--) {
for (let i = dimension - 9; i >= ijMin; i--) {
versionBits = this.copyBit(i, j, versionBits);
}
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 67.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function encodeChar
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
encodeChar(c: char, sb: StringBuilder): number {
if (c === ' '.charCodeAt(0)) {
sb.append(0o3);
return 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 encodeECC200
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static encodeECC200(codewords: string, symbolInfo: SymbolInfo) {
if (codewords.length !== symbolInfo.getDataCapacity()) {
throw new Error(
'The number of codewords does not match the selected symbol'
);
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
public static encode(content: string,
ecLevel: ErrorCorrectionLevel,
hints: Map<EncodeHintType, any> = null): QRCode /*throws WriterException*/ {
// Determine what character encoding has been specified by the caller, if any
- 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 processFinderPatternInfo
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected processFinderPatternInfo(info: FinderPatternInfo): DetectorResult {
const topLeft: FinderPattern = info.getTopLeft();
const topRight: FinderPattern = info.getTopRight();
const bottomLeft: FinderPattern = info.getBottomLeft();
- 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 numericCompaction
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static numericCompaction(codewords: Int32Array, codeIndex: number /*int*/, result: StringBuilder): int {
let count: int = 0;
let end: boolean = false;
let numericCodewords: Int32Array = new Int32Array(DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS);
- 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 applyMaskPenaltyRule3
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static applyMaskPenaltyRule3(matrix: ByteMatrix): number /*int*/ {
let numPenalties = 0;
const array: Array<Uint8Array> = matrix.getArray();
const width: number /*int*/ = matrix.getWidth();
const height: number /*int*/ = matrix.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 findAsteriskPattern
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static findAsteriskPattern(row: BitArray, counters: Int32Array): number[] {
let width = row.getSize();
let rowOffset = row.getNextSet(0);
let counterPosition = 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"