graycoreio/daffodil

View on GitHub

Showing 119 of 121 total issues

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';

    Function daffCustomerAddressEntitiesReducer has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function daffCustomerAddressEntitiesReducer<
      T extends DaffCustomerAddress = DaffCustomerAddress,
    >(
      state = daffCustomerAddressEntitiesAdapter<T>().getInitialState(),
      action: DaffCustomerAddressActions<T> | DaffCustomerActions): DaffOperationEntityState<T> {
    Severity: Major
    Found in libs/customer/state/src/reducers/address-entities/reducer.ts - About 2 hrs to fix

      Function constructor has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(private store: Store<DaffOrderStateRootSlice<T>>) {
          const {
            selectOrderIds,
            selectOrderEntities,
            selectOrders,
      Severity: Major
      Found in libs/order/state/src/facades/order/order.facade.ts - About 2 hrs to fix

        Function createCompositeProductAppliedOptionsEntitiesSelectors has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const createCompositeProductAppliedOptionsEntitiesSelectors = <T extends DaffProduct>(): DaffCompositeProductEntitiesMemoizedSelectors<T> => {
          const {
            selectCompositeProductState,
          } = getDaffCompositeProductFeatureSelector();
          const {

          Function daffCustomerPaymentEntitiesReducer has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function daffCustomerPaymentEntitiesReducer<
            TPayment extends DaffCustomerPayment = DaffCustomerPayment,
            TRequest extends DaffCustomerPaymentRequest = DaffCustomerPaymentRequest,
          >(
            state = daffCustomerPaymentEntitiesAdapter<TPayment>().getInitialState(),
          Severity: Major
          Found in libs/customer-payment/state/src/reducers/payment-entities/reducer.ts - About 2 hrs to fix

            Function getBreadcrumbs has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private getBreadcrumbs(doc: ParentedDocument & KindedDocument): Array<DaffBreadcrumb> {
                const segments = (<string>doc.path).split('/');
                const breadcrumbs = segments
                  .map((segment, i) => getStaticBreadcrumb(segment, segments.slice(0, i).join('/')))
                  .filter((b, i, ary) => !!b && ary.findIndex((e) => e?.label === b.label) === i);
            Severity: Major
            Found in tools/dgeni/src/processors/breadcrumb.ts - About 2 hrs to fix

              Function transformCartTotals has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function transformCartTotals(cart: Partial<MagentoCart>): {totals: DaffCart['totals']} {
                const totalTax = cart.prices.applied_taxes ? cart.prices.applied_taxes.reduce((acc, tax) => (daffAdd(acc, tax.amount.value)), 0) : 0;
                return {
                  totals: {
                    [DaffCartTotalTypeEnum.grandTotal]: {

                Function cartReducer has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function cartReducer<T extends DaffCart = DaffCart>(
                  state = daffCartReducerInitialState,
                  action: ActionTypes<T>,
                ): DaffCartReducerState<T> {
                  switch (action.type) {
                Severity: Major
                Found in libs/cart/state/src/reducers/cart/cart.reducer.ts - About 2 hrs to fix

                  Function search has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    search(query: string, options: DaffSearchProductDriverOptions = {}): Observable<DaffSearchProductDriverResponse> {
                      const queryVariables = this.getVariables(options);
                  
                      return combineLatest([
                        this.apollo.query<MagentoSearchForProductsResponse>({
                  Severity: Minor
                  Found in libs/search-product/driver/magento/src/product-search.service.ts - About 1 hr to fix

                    Function cartCouponReducer has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function cartCouponReducer<T extends DaffCart = DaffCart>(
                      state = daffCartReducerInitialState,
                      action: ActionTypes<T>,
                    ): DaffCartReducerState<T> {
                      switch (action.type) {
                    Severity: Minor
                    Found in libs/cart/state/src/reducers/cart-coupon/cart-coupon.reducer.ts - About 1 hr to fix

                      Function ngAfterContentChecked has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        ngAfterContentChecked() {
                          const nextShift = sidebarViewportContentShift(this.sidebars) + 'px';
                          if (this._shift !== nextShift) {
                            this._shift = nextShift;
                      
                      

                      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 createCategorySelectors has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const createCategorySelectors = <V extends DaffGenericCategory<V>, W extends DaffProduct>(): DaffCategoryMemoizedSelectors<V, W> => {
                        const { selectAllProducts,selectProductEntities } = getDaffProductSelectors<W>();
                      
                        const {
                          selectCategoryEntities,
                      Severity: Minor
                      Found in libs/category/state/src/selectors/category.selector.ts - About 1 hr to fix

                        Function createCartOrderSelectors has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const createCartOrderSelectors = <
                          T extends DaffCart = DaffCart,
                          V extends DaffCartOrderResult = DaffCartOrderResult,
                        >(): DaffCartOrderMemoizedSelectors<T, V> => {
                          const selectCartFeatureState = getDaffCartFeatureSelector<T, V>().selectCartFeatureState;
                        Severity: Minor
                        Found in libs/cart/state/src/selectors/cart-order/cart-order.selector.ts - About 1 hr to fix

                          Function getStaticBreadcrumb has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const getStaticBreadcrumb = (segment: string, parent: string): DaffBreadcrumb => {
                            switch (segment) {
                              case DAFF_DOCS_PATH:
                                return {
                                  label: 'Docs',
                          Severity: Minor
                          Found in tools/dgeni/src/processors/breadcrumb.ts - About 1 hr to fix

                            Function daffCartInMemoryComputeCartTotals has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function daffCartInMemoryComputeCartTotals(cart: DaffCart, products: DaffProduct[]): DaffCart {
                              const shipping = cart.shipping_information ? faker.datatype.number({ min: 0, max: 99 }) : 0;
                              const subtotalExcludingTax = cart.items?.reduce((acc, { product_id }) =>
                                acc + (products.find(({ id }) => id === product_id)?.price || 0),
                              0,
                            Severity: Minor
                            Found in libs/cart/driver/in-memory/src/helpers/compute-cart-totals.ts - About 1 hr to fix

                              Function daffCartOrderReducer has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function daffCartOrderReducer<T extends DaffCartOrderResult = DaffCartOrderResult>(
                                state = daffCartOrderInitialState,
                                action: ActionTypes<
                                  DaffCart,
                                  DaffCartItemInput,
                              Severity: Minor
                              Found in libs/cart/state/src/reducers/cart-order/cart-order.reducer.ts - About 1 hr to fix

                                Function slideAnimation has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  get slideAnimation(): any {
                                    switch (this.toastPosition.config.horizontal + '-' + this.toastPosition.config.vertical) {
                                      case 'left-top':
                                      case 'left-bottom':
                                        return {
                                Severity: Minor
                                Found in libs/design/toast/src/toast/toast-template.component.ts - About 1 hr to fix

                                  Function daffCategoryPageMetadataReducer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function daffCategoryPageMetadataReducer<U extends DaffGenericCategory<U>, W extends DaffProduct>(
                                    state = daffCategoryPageMetadataInitialState,
                                    action: DaffCategoryActions<U, W> | DaffCategoryPageActions<U, W> | DaffCategoryPageProductCollectionActions,
                                  ): DaffCategoryPageMetadataReducerState {
                                    const adapter = getCollectionStateAdapter<DaffCategoryPageMetadataReducerState>();
                                  Severity: Minor
                                  Found in libs/category/state/src/reducers/page-metadata/reducer.ts - About 1 hr to fix

                                    Function daffCartStoreCreditCartReducer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function daffCartStoreCreditCartReducer<T extends DaffCartWithStoreCredit = DaffCartWithStoreCredit>(
                                      state = daffCartReducerInitialState,
                                      action: DaffCartStoreCreditActions,
                                    ): DaffCartReducerState<T> {
                                      switch (action.type) {
                                    Severity: Minor
                                    Found in libs/cart-store-credit/state/src/reducers/cart.reducer.ts - About 1 hr to fix

                                      Function daffAuthReducer has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export function daffAuthReducer(
                                        state = daffAuthInitialState,
                                        action: DaffAuthActions | DaffAuthLoginActions | DaffAuthRegisterSuccess | DaffAuthResetPasswordActions,
                                      ): DaffAuthReducerState {
                                        switch (action.type) {
                                      Severity: Minor
                                      Found in libs/auth/state/src/reducers/auth/auth.reducer.ts - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language