Showing 9 of 319 total issues
File AbstractValidator.spec.ts
has 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {AbstractValidator, ValidationResult} from "./";
import {Severity, ValidationFailure} from "./shared";
class TestPerson {
name?: string;
File CommonValidatorBuilderImpl.spec.ts
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {AbstractValidator} from "../";
import {CommonValidatorBuilder, CommonValidatorBuilderImpl, ValidationOptionsBuilder} from "./";
import {Severity, ValidationFailure} from "../shared";
import {
UnlessCondition,
File StringValidatorBuilderImpl.spec.ts
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {ValidationRule, WhenNotEmptyCondition} from "../validation";
import {
ContainsValidator,
HasLengthValidator,
IsAlphanumericValidator,
StringValidatorBuilderImpl
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export class StringValidatorBuilderImpl<T> extends CommonValidatorBuilderImpl<T, string> implements StringValidatorBuilder<T>, StringValidationOptionsBuilder<T> {
constructor(validationRule: ValidationRule<T, string | Iterable<string>>) {
super(validationRule);
}
CommonValidatorBuilderImpl
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export class CommonValidatorBuilderImpl<T, TProperty> implements ValidationOptionsBuilder<T>,
CommonValidatorBuilder<T, TProperty> {
constructor(protected validationRule: ValidationRule<T, TProperty | Iterable<TProperty>>) {
}
Function isValid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
isValid(input: Date | undefined): boolean {
if (typeof input === "undefined" || input === null) {
return false;
} else if (this.lowerBoundary === "[" && this.upperBoundary === "]") {
return this.lowerDate.getTime() <= input.getTime() && input.getTime() <= this.upperDate.getTime();
- 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 this.lowerDate.getTime() < input.getTime() && input.getTime() < this.upperDate.getTime();
Function isValid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
isValid(input: Iterable<TProperty> | undefined): boolean {
if (input) {
for (let element of input) {
if (element === this.seed) {
return 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 isValid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
isValid(input: Iterable<TProperty> | undefined): boolean {
if (input) {
for (let element of input) {
if (element === this.nonSeed) {
return 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"