DateStringLibrary
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
export class DateStringLibrary {
static validateDateValue(obj: any): Date {
if (!obj) {
return null;
File date-string-library.ts
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @license
* Copyright (c) La Vía Óntica SC, Ontica LLC and contributors. All rights reserved.
*
* See LICENSE.txt in the project root for complete license information.
Function tryParse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static tryParse(value: string): Date {
const dateParts: string[] = this.tryToConvertToDatePartsArray(value);
if (!dateParts) {
return null;
Function tryParse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static tryParse(value: string): Date {
const dateParts: string[] = this.tryToConvertToDatePartsArray(value);
if (!dateParts) {
return 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 compareDates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static compareDates(value1: DateString, value2: DateString): number {
const date1 = this.datePart(value1);
const date2 = this.datePart(value2);
if (date1 && date2) {
- 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 isValidDate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static isValidDate(year: number, month: number, dayOfMonth: number): boolean {
const monthsWith30Days = [3, 5, 8, 10];
const monthsWith31Days = [0, 2, 4, 6, 7, 9, 11];
if (!(1900 <= year && year <= 2078)) {
- 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"