Showing 958 of 958 total issues
Function setHints
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public setHints(hints?: Map<DecodeHintType, any> | null): void {
this.hints = hints;
const tryHarder: boolean = hints !== null && hints !== undefined && undefined !== hints.get(DecodeHintType.TRY_HARDER);
/*@SuppressWarnings("unchecked")*/
- 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 find
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public find(hints: Map<DecodeHintType, any>): FinderPatternInfo /*throws NotFoundException */ {
const tryHarder: boolean = (hints !== null && hints !== undefined) && undefined !== hints.get(DecodeHintType.TRY_HARDER);
const pureBarcode: boolean = (hints !== null && hints !== undefined) && undefined !== hints.get(DecodeHintType.PURE_BARCODE);
const image = this.image;
const maxI = image.getHeight();
Function decodeIsoIec646
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
private decodeIsoIec646(pos: number): DecodedChar {
let fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);
if (fiveBitValue === 15) {
return new DecodedChar(pos + 5, DecodedChar.FNC1);
}
Function constructor
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
public readonly input: Input,
public readonly mode: Mode,
public readonly fromPosition: number,
public readonly characterLength: number,
Function detect
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public detect(): ResultPoint[] {
let left = this.leftInit;
let right = this.rightInit;
let up = this.upInit;
File BitMatrixParser.ts
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BitMatrix from '../../common/BitMatrix';
import Version from './Version';
import FormatException from '../../FormatException';
import IllegalArgumentException from '../../IllegalArgumentException';
Function place
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public place(): void {
let pos = 0;
let row = 4;
let col = 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 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 detect
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private static detect( multiple: boolean, bitMatrix: BitMatrix): Array<ResultPoint[]> {
const barcodeCoordinates = new Array<ResultPoint[]>();
let row = 0;
let column = 0;
let foundBarcodeInRow = false;
- 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 getStartColumn
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private static getStartColumn(detectionResult: DetectionResult,
barcodeColumn: int,
imageRow: int,
leftToRight: boolean): int {
let offset: int = leftToRight ? 1 : -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
Similar blocks of code found in 3 locations. Consider refactoring. Open
for (let x = 0; x < 4 && rowOffset < end; x++) {
let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_PATTERNS);
resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));
for (let counter of counters) {
- 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 100.
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 3 locations. Consider refactoring. Open
for (let x = 0; x < 4 && rowOffset < end; x++) {
let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_PATTERNS);
resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));
for (let counter of counters) {
- 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 100.
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 3 locations. Consider refactoring. Open
for (let x = 0; x < 6 && rowOffset < end; x++) {
let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_PATTERNS);
resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));
for (let counter of counters) {
rowOffset += counter;
- 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 100.
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 decodeTextSegment
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static decodeTextSegment(bits: BitSource, result: StringBuilder): void {
// Three Text values are encoded in a 16-bit value as
// (1600 * C1) + (40 * C2) + C3 + 1
// TODO(bbrown): The Upper Shift with Text doesn't work in the 4 value scenario all the time
let upperShift = false;
Function encode
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public encode(
contents: string,
format: BarcodeFormat,
width: number,
height: number,
Function decodeDataCharacter
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
private decodeDataCharacter(row: BitArray, pattern: FinderPattern, outsideChar: boolean): DataCharacter {
let counters = this.getDataCharacterCounters();
for (let x = 0; x < counters.length; x++) {
counters[x] = 0;
Function constructor
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
constructor(solution: Edge) {
const input = solution.input;
let size = 0;
let bytesAL: number[] = [];
const randomizePostfixLength = [];
- 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 checkAndNudgePoints
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
protected static checkAndNudgePoints(
image: BitMatrix,
points: Float32Array
): void /*throws NotFoundException*/ {
- 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 parseFromString
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static parseFromString(stringRepresentation: string, setString: string, unsetString: string): BitMatrix {
if (stringRepresentation === null) {
throw new IllegalArgumentException('stringRepresentation cannot be 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 toString
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public toString(): String {
let result: StringBuilder = new StringBuilder(/*8 * this.getDegree()*/); // dynamic string size in JS
for (let degree /*int*/ = this.getDegree(); degree >= 0; degree--) {
let coefficient: /*int*/ number = this.getCoefficient(degree);
if (coefficient !== 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"