Showing 958 of 958 total issues
Similar blocks of code found in 4 locations. Consider refactoring. Open
new Version(3, Int32Array.from([6, 22]),
new ECBlocks(15, new ECB(1, 55)),
new ECBlocks(26, new ECB(1, 44)),
new ECBlocks(18, new ECB(2, 17)),
new ECBlocks(22, new ECB(2, 13))),
- 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 61.
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 4 locations. Consider refactoring. Open
new Version(6, Int32Array.from([6, 34]),
new ECBlocks(18, new ECB(2, 68)),
new ECBlocks(16, new ECB(4, 27)),
new ECBlocks(24, new ECB(4, 19)),
new ECBlocks(28, new ECB(4, 15))),
- 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 61.
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 4 locations. Consider refactoring. Open
new Version(4, Int32Array.from([6, 26]),
new ECBlocks(20, new ECB(1, 80)),
new ECBlocks(18, new ECB(2, 32)),
new ECBlocks(26, new ECB(2, 24)),
new ECBlocks(16, new ECB(4, 9))),
- 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 61.
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 4 locations. Consider refactoring. Open
new Version(2, Int32Array.from([6, 18]),
new ECBlocks(10, new ECB(1, 34)),
new ECBlocks(16, new ECB(1, 28)),
new ECBlocks(22, new ECB(1, 22)),
new ECBlocks(28, new ECB(1, 16))),
- 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 61.
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 encodeMinimally
has 32 lines of code (exceeds 25 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().
Function lookup
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static lookup(
dataCodewords: number,
shape = SymbolShapeHint.FORCE_NONE,
minSize: Dimension = null,
maxSize: Dimension = null,
Function getDataMaskBit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static getDataMaskBit(maskPattern: number /*int*/, x: number /*int*/, y: number /*int*/): boolean {
let intermediate: number; /*int*/
let temp: number; /*int*/
switch (maskPattern) {
case 0:
Function correctTopRight
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private correctTopRight(points: ResultPoint[]): ResultPoint {
// A..D
// | :
// B--C
let pointA = points[0];
Function readVersion
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public readVersion(): Version /*throws FormatException*/ {
if (this.parsedVersion !== null && this.parsedVersion !== undefined) {
return this.parsedVersion;
}
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 convertUPCEtoUPCA
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static convertUPCEtoUPCA(upce: string): string {
// the following line is equivalent to upce.getChars(1, 7, upceChars, 0);
const upceChars = upce.slice(1, 7).split('').map(x => x.charCodeAt(0));
const result: StringBuilder = new StringBuilder(/*12*/);
result.append(upce.charAt(0));
Function createDecoder
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createDecoder(information: BitArray): AbstractExpandedDecoder {
try {
if (information.get(1)) {
return new AI01AndOtherAIs(information);
Function decodeAlphanumeric
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private decodeAlphanumeric(pos: number): DecodedChar {
let fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
if (fiveBitValue === 15) {
return new DecodedChar(pos + 5, DecodedChar.FNC1);
}
Function createDecoder
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function createDecoder(information: BitArray): AbstractExpandedDecoder {
try {
if (information.get(1)) {
return new AI01AndOtherAIs(information);
Function drawModeMessage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static drawModeMessage(matrix: BitMatrix, compact: boolean, matrixSize: int, modeMessage: BitArray): void {
let center: int = Integer.truncDivision(matrixSize, 2);
if (compact) {
for (let i /*int*/ = 0; i < 7; i++) {
let offset: int = center - 3 + i;
Function encodeHighLevel
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static encodeHighLevel(
msg: string,
shape = SymbolShapeHint.FORCE_NONE,
minSize: Dimension = null,
maxSize: Dimension = 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 getEDFBytes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
getEDFBytes(): Uint8Array {
const numberOfThirds = Math.ceil(this.characterLength / 4.0);
const result = new Uint8Array(numberOfThirds * 3);
let pos = this.fromPosition;
const endPos = Math.min(
- 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 encodeMaximal
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
encodeMaximal(context: EncoderContext): void {
const buffer = new StringBuilder();
let lastCharSize = 0;
let backtrackStartPosition = context.pos;
let backtrackBufferLength = 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 maybeEmbedPositionAdjustmentPatterns
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static maybeEmbedPositionAdjustmentPatterns(version: Version, matrix: ByteMatrix): void {
if (version.getVersionNumber() < 2) { // The patterns appear if version >= 2
return;
}
const index = version.getVersionNumber() - 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 calculateThresholdForBlock
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static calculateThresholdForBlock(luminances: Uint8ClampedArray,
subWidth: number /*int*/,
subHeight: number /*int*/,
width: number /*int*/,
height: number /*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"