graycoreio/daffodil

View on GitHub
libs/customer-order/driver/magento/src/transforms/responses/order.ts

Summary

Maintainability
B
5 hrs
Test Coverage

File order.ts has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  daffAdd,
  daffSubtract,
} from '@daffodil/core';
import { MagentoDiscount } from '@daffodil/driver/magento';
Severity: Minor
Found in libs/customer-order/driver/magento/src/transforms/responses/order.ts - About 2 hrs to fix

    Function daffMagentoCustomerOrderTransformItem has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    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 daffMagentoCustomerOrderTransformTotals has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function daffMagentoCustomerOrderTransformTotals(totals: MagentoOrderTotal): DaffOrderTotal[] {
        return [
          {
            label: 'Subtotal',
            type: DaffOrderTotalTypeEnum.Subtotal,

        There are no issues that match your filters.

        Category
        Status