Showing 18 of 18 total issues
StringValidator
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export class StringValidator extends Validator {
public static isString(options?: ValidatorOptions) {
return Validator.createClassDecorator<string, StringValidatorOptions>(StringValidator.validateIsString, options);
}
Function updatePackageJsonExportsIfNeededAndStopIfUpdated
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updatePackageJsonExportsIfNeededAndStopIfUpdated(generatedEntryMap) {
const packageExports = pkg.exports;
let hasUpdates = false;
Function deserialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function deserialize<T>(value: string): T {
// --------- undefined
if (value === 'undefined') {
return undefined as T;
}
- 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 deserialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function deserialize<T>(value: string): T {
// --------- undefined
if (value === 'undefined') {
return undefined as T;
}
Function validateCompareTo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static validateCompareTo(value: number, options?: NumberValidatorOptions) {
const ValidationExceptionClass = options?.exceptionType || NumberValidationFailedException;
if (!options || options.compare === undefined || !options.operator) {
throw new ValidationExceptionClass('Required options parameter is missing');
Function updatePackageJsonExportsIfNeededAndStopIfUpdated
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function updatePackageJsonExportsIfNeededAndStopIfUpdated(generatedEntryMap) {
const packageExports = pkg.exports;
let hasUpdates = 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 doMath
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private doMath(duration: Duration, isAddition = true): DateTime {
const operand = isAddition ? 1 : -1;
let date = new Date(this.value);
if (duration.years) {
Function validateBases
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function validateBases(input: string, inputBase: number, outputBase: number) {
if (inputBase < 2 || outputBase < 2) {
throw new InvalidNumberBaseException(`Input Base: ${inputBase} | Output Base: ${outputBase}`);
}
if (inputBase > 36 || outputBase > 36) {
- 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 from
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static from(datetime: string, format: string): DateTime {
if (!datetime || !format) {
throw new InvalidDateTimeException('Date string or format must not be empty or 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 validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public validate() {
const { name } = this.constructor;
if (this.value === null || typeof this.value === 'undefined') {
throw new ValueObjectCanNotBeNullException(name);
- 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 doMath
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private doMath(duration: Duration, isAddition = true): DateTime {
const operand = isAddition ? 1 : -1;
let date = new Date(this.value);
if (duration.years) {
- 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 with
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static with<T extends ValueObjectType>(
type: MessageType,
headersOrName: MessageHeaders | MessageName,
payloadOrSource?: T | MessageSource,
metadataOrPayload?: MessageMetadata | T,
- 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
Avoid too many return
statements within this function. Open
return date as T;
Avoid too many return
statements within this function. Open
return parsedJson as T;
Avoid too many return
statements within this function. Open
return String(value) as T;
Avoid too many return
statements within this function. Open
return Number(value) as T;
Avoid too many return
statements within this function. Open
return Symbol(sym[1]) as T;
Function validatePartial
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static validatePartial(value: string, options?: StringValidatorOptions) {
const ValidationExceptionClass = options?.exceptionType || StringValidationFailedException;
if (!options?.partial && !options?.startsWith && !options?.endsWith) {
throw new ValidationExceptionClass('Missing required option "partial" or "startsWith" or "endsWith"');
- 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"