Showing 958 of 958 total issues
RSSExpandedReader
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export default class RSSExpandedReader extends AbstractRSSReader {
private static readonly SYMBOL_WIDEST = [7, 5, 4, 3, 1];
private static readonly EVEN_TOTAL_SUBSET = [4, 20, 52, 104, 204];
private static readonly GSUM = [0, 348, 1388, 2948, 3988];
Function getC40Words
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
getC40Words(c40: boolean, fnc1: number): Uint8Array {
const c40Values = [];
for (let i = 0; i < this.characterLength; i++) {
const ci = this.input.charAt(this.fromPosition + i);
if (
Function selectBestPatterns
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private selectBestPatterns(): FinderPattern[] /*throws NotFoundException */ {
const startSize = this.possibleCenters.length;
if (startSize < 3) {
// Couldn't find enough finder patterns
Function encodeHighLevel
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static encodeHighLevel(
msg: string,
shape = SymbolShapeHint.FORCE_NONE,
minSize: Dimension = null,
maxSize: Dimension = null,
Function encode
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public encode(context: EncoderContext) {
// step B
const n = HighLevelEncoder.determineConsecutiveDigitCount(
context.getMessage(),
context.pos
Function crossCheckVertical
has 53 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: BitMatrix = this.image;
const maxI = image.getHeight();
Function decode
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
static decode(codewords: Int32Array, ecLevel: string): DecoderResult {
// pass encoding to result (will be used for decode symbols in byte mode)
let result: StringBuilder = new StringBuilder('');
// let encoding: Charset = StandardCharsets.ISO_8859_1;
let encoding = CharacterSetECI.ISO8859_1;
Function crossCheckHorizontal
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
private crossCheckHorizontal(startJ: number /*int*/, centerI: number /*int*/, maxCount: number /*int*/,
originalStateCountTotal: number /*int*/): number/*float*/ {
const image: BitMatrix = this.image;
const maxJ = image.getWidth();
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (outsideChar) {
if (oddSum > 12) {
decrementOdd = true;
}
else if (oddSum < 4) {
- 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 77.
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
else {
if (oddSum > 11) {
decrementOdd = true;
}
else if (oddSum < 5) {
- 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 77.
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
File Encoder.ts
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BitArray from '../../common/BitArray';
import IllegalArgumentException from '../../IllegalArgumentException';
import StringUtils from '../../common/StringUtils';
import BitMatrix from '../../common/BitMatrix';
import AztecCode from './AztecCode';
Function extractDataRegion
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private extractDataRegion(bitMatrix: BitMatrix): BitMatrix {
const symbolSizeRows = this.version.getSymbolSizeRows();
const symbolSizeColumns = this.version.getSymbolSizeColumns();
if (bitMatrix.getHeight() !== symbolSizeRows) {
- 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 decodeAnsiX12Segment
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private static decodeAnsiX12Segment(bits: BitSource,
result: StringBuilder): void {
// Three ANSI X12 values are encoded in a 16-bit value as
// (1600 * C1) + (40 * C2) + C3 + 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 encode
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public encode(context: EncoderContext): void {
// step C
const buffer = new StringBuilder();
while (context.hasMoreCharacters()) {
const c = context.getCurrentChar();
- 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 interleaveWithECBytes
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static interleaveWithECBytes(bits: BitArray,
numTotalBytes: number /*int*/,
numDataBytes: number /*int*/,
numRSBlocks: number /*int*/): BitArray /*throws WriterException*/ {
- 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 addMissingRows
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
addMissingRows(missingStartRows: int, missingEndRows: int, isLeft: boolean): BoundingBox {
let newTopLeft: ResultPoint = this.topLeft;
let newBottomLeft: ResultPoint = this.bottomLeft;
let newTopRight: ResultPoint = this.topRight;
let newBottomRight: ResultPoint = this.bottomRight;
- 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 getBlackRow
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public getBlackRow(y: number /*int*/, row: BitArray): BitArray /*throws NotFoundException*/ {
const source = this.getLuminanceSource();
const width = source.getWidth();
if (row === undefined || row === null || row.getSize() < width) {
row = new BitArray(width);
- 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 decodeRow
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
let theCounters = this.counters;
theCounters.fill(0);
this.decodeRowResult = '';
- 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 decode
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public decode(image: BinaryBitmap, hints?: Map<DecodeHintType, any>): Result {
try {
return this.doDecode(image, hints);
} catch (nfe) {
const tryHarder = hints && (hints.get(DecodeHintType.TRY_HARDER) === true);
- 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 getRSSvalue
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static getRSSvalue(widths: number[], maxWidth: number, noNarrow: boolean): number {
let n = 0;
for (let width of widths) {
n += width;
}
- 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"