Showing 605 of 958 total issues
Function getC40Value
has a Cognitive Complexity of 139 (exceeds 5 allowed). Consider refactoring. Open
getC40Value(c40: boolean, setIndex: number, c: number, fnc1: number): number {
if (c === fnc1) {
if (!(setIndex === 2)) {
throw new Error('FNC1 cannot be used in C40 shift 2');
}
- 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 130 (exceeds 5 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
const convertFNC1 = hints && (hints.get(DecodeHintType.ASSUME_GS1) === true);
const startPatternInfo = Code128Reader.findStartPattern(row);
const startCode = startPatternInfo[2];
- 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
File MinimalEncoder.ts
has 907 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Charset from '../../util/Charset';
import { char } from '../../../customTypings';
import {
MACRO_05_HEADER,
MACRO_06_HEADER,
Function lookAheadTestIntern
has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring. Open
static lookAheadTestIntern(
msg: string,
startpos: number,
currentMode: number
): number {
- 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 guessEncoding
has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring. Open
public static guessEncoding(bytes: Uint8Array, hints: Map<DecodeHintType, any>): string {
if (hints !== null && hints !== undefined && undefined !== hints.get(DecodeHintType.CHARACTER_SET)) {
return hints.get(DecodeHintType.CHARACTER_SET).toString();
}
// For now, merely tries to distinguish ISO-8859-1, UTF-8 and Shift_JIS,
- 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
File RSSExpandedReader.ts
has 749 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BarcodeFormat from '../../../BarcodeFormat';
// import ResultPoint from '../../../ResultPoint';
import BitArray from '../../../common/BitArray';
import MathUtils from '../../../common/detector/MathUtils';
import DecodeHintType from '../../../DecodeHintType';
File BrowserCodeReader.ts
has 686 lines of code (exceeds 250 allowed). Consider refactoring. Open
import ArgumentException from '../core/ArgumentException';
import BinaryBitmap from '../core/BinaryBitmap';
import ChecksumException from '../core/ChecksumException';
import HybridBinarizer from '../core/common/HybridBinarizer';
import DecodeHintType from '../core/DecodeHintType';
Function encode
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
public static encode(data: Uint8Array, minECCPercent: int, userSpecifiedLayers: int): AztecCode {
// High-level encode
let bits: BitArray = new HighLevelEncoder(data).encode();
// stuff bits and choose symbol size
- 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 a Cognitive Complexity of 69 (exceeds 5 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();
- 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 60 (exceeds 5 allowed). Consider refactoring. Open
public detect(): Array<ResultPoint> /*throws NotFoundException*/ {
let left = this.leftInit;
let right = this.rightInit;
let up = this.upInit;
let down = this.downInit;
- 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 234 lines of code (exceeds 25 allowed). Consider refactoring. Open
public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
const convertFNC1 = hints && (hints.get(DecodeHintType.ASSUME_GS1) === true);
const startPatternInfo = Code128Reader.findStartPattern(row);
const startCode = startPatternInfo[2];
Function adjustOddEvenCounts
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
private adjustOddEvenCounts(outsideChar: boolean, numModules: number) {
let oddSum = MathUtils.sum(new Int32Array(this.getOddCounts()));
let evenSum = MathUtils.sum(new Int32Array(this.getEvenCounts()));
- 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
BrowserCodeReader
has 60 functions (exceeds 20 allowed). Consider refactoring. Open
export class BrowserCodeReader {
/**
* If navigator is present.
*/
public get hasNavigator() {
Function decodeTextSegment
has a Cognitive Complexity of 54 (exceeds 5 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;
- 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 decodeTextCompaction
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
private static decodeTextCompaction(textCompactionData: Int32Array,
byteCompactionData: Int32Array,
length: int,
result: StringBuilder): void {
// Beginning from an initial state of the Alpha sub-mode
- 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 calculateBlackPoints
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
private static calculateBlackPoints(luminances: Uint8ClampedArray,
subWidth: number /*int*/,
subHeight: number /*int*/,
width: number /*int*/,
height: number /*int*/): Int32Array[] {
- 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 getCornerFromArea
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
private getCornerFromArea(left: number, right: number, top: number, bottom: number, maximizeX: boolean, maximizeY: boolean): ResultPoint {
let resX = maximizeX ? 0 : Number.MAX_VALUE;
let resY = maximizeY ? 0 : Number.MAX_VALUE;
for (let x = left; x < right; x++) {
for (let y = top; y < bottom; y++) {
- 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
File PDF417ScanningDecoder.ts
has 485 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright 2013 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
File DecodedBitStreamParser.ts
has 476 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Function decodeC40Segment
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
private static decodeC40Segment(bits: BitSource, result: StringBuilder): void {
// Three C40 values are encoded in a 16-bit value as
// (1600 * C1) + (40 * C2) + C3 + 1
// TODO(bbrown): The Upper Shift with C40 doesn't work in the 4 value scenario all the time
let upperShift = 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"