Showing 119 of 121 total issues
Function cartShippingAddressReducer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function cartShippingAddressReducer<T extends DaffCart>(
state = daffCartReducerInitialState,
action: ActionTypes,
): DaffCartReducerState<T> {
switch (action.type) {
Function cartBillingAddressReducer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function cartBillingAddressReducer<T extends DaffCart = DaffCart>(
state = daffCartReducerInitialState,
action: ActionTypes<T>,
): DaffCartReducerState<T> {
switch (action.type) {
Function cartShippingInformationReducer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function cartShippingInformationReducer<T extends DaffCart = DaffCart>(
state = daffCartReducerInitialState,
action: ActionTypes<T>,
): DaffCartReducerState<T> {
switch (action.type) {
Function daffCartItemEntitiesReducer
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffCartItemEntitiesReducer<
T extends DaffCart = DaffCart,
U extends DaffCartItemInput = DaffCartItemInput,
>(
state = daffCartItemEntitiesAdapter<T['items'][number]>().getInitialState(),
Function sortTrie
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
export const sortTrie = <T extends Trie>(trie: T, sortData: TrieSortData, parent = ''): T => {
const path = parent && trie.id ? `${parent}/${trie.id}` : trie.id || parent;
const sort = sortData[path];
trie.children = trie.children
- 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 createCompositeProductAppliedOptionsEntitiesSelectors
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
const createCompositeProductAppliedOptionsEntitiesSelectors = <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors<T> => {
const {
selectCompositeProductState,
} = getDaffCompositeProductFeatureSelector();
const {
- 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 constructor
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
private cartFacade: DaffCartFacade,
) {
this.currentStep$ = combineLatest([
this._currentStep$,
Function createConfigurableProductAppliedAttributesEntitiesSelectors
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createConfigurableProductAppliedAttributesEntitiesSelectors = <T extends DaffProduct>(): DaffConfigurableProductEntitiesMemoizedSelectors<T> => {
const {
selectConfigurableProductState,
} = getDaffConfigurableProductFeatureSelector();
const adapterSelectors = daffConfigurableProductAppliedAttributesEntitiesAdapter().getSelectors();
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
private productFactory: DaffProductExtensionFactory,
private productImageFactory: DaffProductImageFactory) {
this._products = [
'1001',
Function fakeTree
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private fakeTree(depth: number = 0): DaffNavigationTree {
const children = depth !== 0
? [...Array(faker.datatype.number({ min:1, max:3 }))].map(() => this.fakeTree(depth - 1))
: [];
Function createProductReviewEntitiesSelectors
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createProductReviewEntitiesSelectors = <T extends DaffProductReview = DaffProductReview>(): DaffProductReviewEntitiesMemoizedSelectors<T> => {
const {
selectReviewsState,
} = getDaffReviewsFeatureSelector<T>();
const adapterSelectors = daffProductReviewEntitiesAdapter<T>().getSelectors();
Function daffAuthorizeNetReducer
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffAuthorizeNetReducer <T extends DaffAuthorizeNetTokenRequest>(
state: DaffAuthorizeNetReducerState = daffAuthorizeNetReducerInitialState,
action: DaffAuthorizeNetActions<T> | DaffPaymentActions,
): DaffAuthorizeNetReducerState {
switch (action.type) {
Function daffMagentoCustomerOrderTransformItem
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoCustomerOrderTransformItem(item: MagentoOrderItem, order: MagentoCustomerOrder, qty: number): DaffOrderItem {
const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);
const rowTotal = qty * item.product_sale_price.value;
const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);
Function open
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
open(
toast: DaffToastData,
configuration?: Partial<DaffToastConfiguration>,
): DaffToast {
if(this._parentToast && this.options.useParent) {
Function forRoot
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static forRoot(): ModuleWithProviders<DaffCartMagentoDriverModule> {
return {
ngModule: DaffCartMagentoDriverModule,
providers: [
provideDaffCartDriver(DaffMagentoCartService),
Function daffMagentoCustomerOrderTransformItem
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoCustomerOrderTransformItem(item: MagentoOrderItem, order: MagentoCustomerOrder, qty: number): DaffOrderItem {
const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);
const rowTotal = qty * item.product_sale_price.value;
const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);
Function daffMagentoTransformItem
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoTransformItem(item: MagentoOrderItem, order: MagentoOrder, qty: number): DaffOrderItem {
const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);
const rowTotal = qty * item.product_sale_price.value;
const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);
Function listOrders
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private listOrders(reqInfo: RequestInfo) {
const request: DaffCollectionRequest | null = reqInfo.utils.getJsonBody(reqInfo.req);
const pageSize = request?.pageSize || DEFAULT_PAGE_SIZE;
const currentPage = request?.currentPage || 1;
const orders: DaffOrder[] = reqInfo.collection;
Function constructor
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
injector: Injector,
private componentFactoryResolver: ComponentFactoryResolver,
) {
[
Function createProductPageSelectors
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createProductPageSelectors = <T extends DaffProductReview = DaffProductReview>(): DaffProductPageReviewsMemoizedSelectors => {
const {
selectReviewsState,
} = getDaffReviewsFeatureSelector<T>();