graycoreio/daffodil

View on GitHub

Showing 119 of 121 total issues

Function daffCategoryReducer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function daffCategoryReducer<U extends DaffGenericCategory<U>, W extends DaffProduct>(
  state = daffCategoryInitialState,
  action: DaffCategoryActions<U, W> | DaffCategoryPageActions<U, W> | DaffCategoryPageProductCollectionActions,
): DaffCategoryReducerState {
  switch (action.type) {
Severity: Minor
Found in libs/category/state/src/reducers/category/category.reducer.ts - About 1 hr to fix

    Function canActivate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      canActivate(
        next: ActivatedRouteSnapshot,
        state: RouterStateSnapshot,
      ): Observable<UrlTree | boolean> {
        return this.driver.resolve(this.urlNormalizer.normalize(state.url)).pipe(
    Severity: Minor
    Found in libs/external-router/routing/src/guard/existence.guard.ts - About 1 hr to fix

      Function forRoot has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static forRoot(): ModuleWithProviders<DaffUpsellProductsMagentoDriverModule> {
          return {
            ngModule: DaffUpsellProductsMagentoDriverModule,
            providers: [
              {
      Severity: Minor
      Found in libs/upsell-products/driver/magento/src/magento.module.ts - About 1 hr to fix

        Function daffSearchCreateSearchSelectors has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const daffSearchCreateSearchSelectors = <T extends DaffSearchResult = DaffSearchResult, R extends DaffSearchStateRootSlice<T> = DaffSearchStateRootSlice<T>>(
          stateSelector: MemoizedSelector<R, DaffSearchReducerState<T>>,
        ) => {
          const selectSearchLoading = createSelector(
            stateSelector,
        Severity: Minor
        Found in libs/search/state/src/selectors/search.selector.ts - About 1 hr to fix

          Function createTotals has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private createTotals(): DaffOrderTotal[] {
              return [
                this.totalFactory.create({
                  label: 'Grand Total',
                  type: DaffOrderTotalTypeEnum.GrandTotal,
          Severity: Minor
          Found in libs/order/testing/src/factories/order.factory.ts - About 1 hr to fix

            Function addItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private addItem(reqInfo: RequestInfo): DaffCart {
                const cart = this.getCart(reqInfo);
                const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);
                const itemInput = reqInfo.utils.getJsonBody(reqInfo.req);
                const existingCartItemIndex = cart.items.findIndex(item => item.product_id === itemInput.productId);

              Function ngAfterContentChecked has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function list has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  list(cartId?: DaffCart['id']): Observable<DaffOrderCollection> {
                    return this.apollo.query<MagentoGetGuestOrdersResponse>({
                      query: getGuestOrders(this.extraOrderFragments),
                      variables: {
                        cartId,
                Severity: Minor
                Found in libs/order/driver/magento/2-4-1/src/order.service.ts - About 1 hr to fix

                  Function forRoot has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static forRoot(): ModuleWithProviders<DaffCompositeProductMagentoDriverModule> {
                      return {
                        ngModule: DaffCompositeProductMagentoDriverModule,
                        providers: [
                          ...provideDaffProductMagentoExtraProductFragments(magentoBundledProductFragment),

                    Function daffCustomerReducer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const daffCustomerReducer = <T extends DaffCustomer = DaffCustomer>(
                      state = daffCustomerInitialState,
                      action: DaffCustomerActions<T> | DaffCustomerAddressActions,
                    ): DaffCustomerReducerState<T> => {
                      switch (action.type) {
                    Severity: Minor
                    Found in libs/customer/state/src/reducers/customer/reducer.ts - About 1 hr to fix

                      Function daffSearchProductCollectionReducer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const daffSearchProductCollectionReducer = (
                        state: DaffCollectionMetadata = daffCollectionReducerInitialState,
                        action: DaffSearchActions | DaffSearchProductCollectionActions,
                      ): DaffCollectionMetadata => {
                        switch (action.type) {
                      Severity: Minor
                      Found in libs/search-product/state/src/reducers/collection/reducer.ts - About 1 hr to fix

                        Function cartResolveReducer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Function getAnimationState has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const getAnimationState = (open: boolean, mode: DaffSidebarMode): DaffSidebarAnimationState => {
                            if(mode === 'side') {
                              return 'none';
                            }
                          
                          
                          Severity: Minor
                          Found in libs/design/sidebar/src/animation/sidebar-animation-state.ts - About 55 mins to fix

                          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 onAnimationComplete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                            @HostListener('@transformSidebar.done', ['$event']) onAnimationComplete(e: AnimationEvent) {
                              if(isOpening(<DaffSidebarAnimationState>e.fromState, <DaffSidebarAnimationState>e.toState)) {
                                this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement);
                          
                                const focusableChild = (<HTMLElement>this._elementRef.nativeElement.querySelector(daffFocusableElementsSelector));
                          Severity: Minor
                          Found in libs/design/sidebar/src/sidebar/sidebar.component.ts - About 55 mins to fix

                          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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                            create(address?: DaffPersonalAddress): DemoCheckoutAddressFormGroup {
                              return this.fb.group({
                                firstname: [address ? address.firstname : '', Validators.required],
                                lastname: [address ? address.lastname : '', Validators.required],
                                street: [address ? address.street : '', Validators.required],

                          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 createConfigInjectionToken has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const createConfigInjectionToken = <T = unknown>(
                            defaultConfig: T | InjectionToken<T>,
                            desc: TokenDesc<T>,
                            options?: Partial<TokenOptions<T>>,
                          ): DaffConfigInjectionToken<T> => {
                          Severity: Minor
                          Found in libs/core/src/injection-tokens/config.factory.ts - About 45 mins to fix

                          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 _createOverlay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            protected async _createOverlay(activatorElement: ViewContainerRef, component: DaffMenuSlot) {
                              if (!this._overlay) {
                                this._overlay = daffMenuCreateOverlay(this.overlay, activatorElement.element);
                                if(typeof component === 'object' && (<DaffLazyComponent>component)?.import) {
                                  component = await (<DaffLazyComponent>component).import();
                          Severity: Minor
                          Found in libs/design/menu/src/services/menu.service.ts - About 35 mins to fix

                          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 isSidebarViewportContentPadded has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const isSidebarViewportContentPadded = (sidebars: QueryList<DaffSidebarComponent>, side: DaffSidebarSide): boolean =>
                            sidebars.reduce((acc: boolean, sidebar) => {
                              if(!(sidebar.mode === DaffSidebarModeEnum.SideFixed && sidebar.open)) {
                                return acc || false;
                              }
                          Severity: Minor
                          Found in libs/design/sidebar/src/sidebar-viewport/utils/content-pad.ts - About 35 mins to fix

                          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 sidebarViewportContentShift has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const sidebarViewportContentShift = (sidebars: QueryList<DaffSidebarComponent>): number =>
                            sidebars.reduce((acc: number, sidebar) => {
                              if(!isViewportContentShifted(sidebar.mode, sidebar.open)) {
                                return acc;
                              }
                          Severity: Minor
                          Found in libs/design/sidebar/src/sidebar-viewport/utils/content-shift.ts - About 35 mins to fix

                          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 add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            add(gallery: DaffMediaGalleryRegistration, thumbnail?: DaffThumbnailRegistration) {
                              if(this.galleries[gallery.name]) {
                                let newGallery = this.galleries[gallery.name].getValue();
                          
                                if(thumbnail) {
                          Severity: Minor
                          Found in libs/design/media-gallery/src/registry/media-gallery.registry.ts - About 35 mins to fix

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language