CartDeliveryComponent
has 21 functions (exceeds 20 allowed). Consider refactoring.
@Component({
selector: 'app-cart-delivery',
templateUrl: './cart-delivery.component.html',
styleUrls: ['./cart-delivery.component.scss']
})
File cart-delivery.component.ts
has 253 lines of code (exceeds 250 allowed). Consider refactoring.
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { combineLatest, Observable } from 'rxjs';
import { Delivery } from '../../../shared/interfaces/delivery';
import { DeliveryService } from '../../../shared/services/delivery.service';
Function getChildForm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
static getChildForm(type: string, minimalForm: boolean, delivery: Delivery = null): FormGroup {
return new FormGroup({
email: new FormControl(delivery && delivery[type] && delivery[type].email ? delivery[type].email : '',
[Validators.required, Validators.minLength(1), Validators.email]
),
Function getChildForm
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
static getChildForm(type: string, minimalForm: boolean, delivery: Delivery = null): FormGroup {
return new FormGroup({
email: new FormControl(delivery && delivery[type] && delivery[type].email ? delivery[type].email : '',
[Validators.required, Validators.minLength(1), Validators.email]
),
Function saveDelivery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
saveDelivery() {
if (this.form.valid && this.cart && this.cart.id && this.cart.user) {
this.disableDeliveryButton = true;
const delivery: Delivery = {...this.form.value, ...{user: this.cart.user}};
if (!delivery.carts || !delivery.carts.length) {
Function getForm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
static getForm(delivery: Delivery = null, minimalForm: boolean = false): FormGroup {
return new FormGroup({
key: new FormControl(delivery && delivery.id ? delivery.id : null),
user: new FormControl(delivery && delivery.user ? delivery.user : null),
cart: new FormControl(delivery && delivery.carts ? delivery.carts : []),
There are no issues that match your filters.