graycoreio/daffodil

View on GitHub

Showing 119 of 121 total issues

Function getByUrl has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getByUrl(categoryRequest: DaffCategoryUrlRequest): Observable<DaffGetCategoryResponse> {
    return combineLatest([
      this.apollo.query<MagentoCategoryUrlResolverResponse>({
        query: MagentoResolveCategoryUrl,
        variables: {
Severity: Minor
Found in libs/category/driver/magento/src/category.service.ts - About 1 hr to fix

    Function daffMagentoTransformTotals has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function daffMagentoTransformTotals(totals: MagentoOrderTotal): DaffOrderTotal[] {
      return [
        {
          label: 'Subtotal',
          type: DaffOrderTotalTypeEnum.Subtotal,
    Severity: Minor
    Found in libs/order/driver/magento/2-4-1/src/transforms/responses/order.ts - About 1 hr to fix

      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,

        Function daffOperationStateSelectorFactory has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function daffOperationStateSelectorFactory <
          TRootState,
          TState extends DaffOperationState = DaffOperationState
        >(
          selectState: Selector<TRootState, TState>,
        Severity: Minor
        Found in libs/core/state/src/operation/selectors.ts - About 1 hr to fix

          Function transformTotals has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function transformTotals(totals: {
            grand_total: number;
            subtotal: number;
            shipping: number;
            discount: number;
          Severity: Minor
          Found in libs/order/driver/magento/2-4-0/src/transforms/responses/order.ts - About 1 hr to fix

            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,

              Function getBreadcrumbs has a Cognitive Complexity of 11 (exceeds 5 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: Minor
              Found in tools/dgeni/src/processors/breadcrumb.ts - About 1 hr 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 transformItem has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function transformItem(item: MagentoGraycoreOrderItem): DaffOrderItem {
                return {
                  id: null,
                  item_id: null,
                  type: DaffOrderItemType.Simple,
              Severity: Minor
              Found in libs/order/driver/magento/2-4-0/src/transforms/responses/order.ts - About 1 hr to fix

                Function load has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  load(name: string, script: DaffExternalScript): Observable<boolean> {
                    // Don't load the same script twice.
                    if(this.scriptMap.has(name)){
                      return this.scriptMap.get(name).subject;
                    }
                Severity: Minor
                Found in libs/core/external-script/src/external-script.service.ts - About 1 hr to fix

                  Function createAuthorizeNetSelectors has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const createAuthorizeNetSelectors = (): DaffAuthorizeNetMemoizedSelectors => {
                  
                    /**
                     * AuthorizeNet Feature State
                     */
                  Severity: Minor
                  Found in libs/authorizenet/state/src/selectors/authorize-net.selector.ts - About 1 hr to fix

                    Function app has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function app(): express.Express {
                      const server = express();
                      const __filename = fileURLToPath(import.meta.url);
                      const __dirname = dirname(__filename);
                      const distFolder = join(__dirname, '../browser');
                    Severity: Minor
                    Found in apps/daffio/server/server.ts - About 1 hr to fix

                      Function createCategoryFeatureSelectors has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const createCategoryFeatureSelectors = <V extends DaffGenericCategory<V>>(): DaffCategoryEntitiesMemoizedSelectors<V> => {
                      
                        const entitiesSelectors = daffCategoryEntitiesAdapter<V>().getSelectors();
                        const categoryFeatureState = getDaffCategoryFeatureSelector<V>().selectCategoryFeatureState;
                      
                      

                        Function createBestSellersSelectors has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const createBestSellersSelectors = <T extends DaffProduct>(): DaffBestSellersMemoizedSelectors<T> => {
                          const {
                            selectAllProducts,
                          } = getDaffProductEntitiesSelectors<T>();
                          const {

                          Function createCountryEntitySelectors has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const createCountryEntitySelectors = <T extends DaffCountry = DaffCountry>() => {
                            const { selectGeographyFeatureState } = getDaffGeographyFeatureStateSelector<T>();
                            const selectCountryEntitiesState = createSelector(
                              selectGeographyFeatureState,
                              state => state.countries,
                          Severity: Minor
                          Found in libs/geography/state/src/selectors/country-entities.selector.ts - About 1 hr to fix

                            Function createCategoryPageSelectors has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const createCategoryPageSelectors = <V extends DaffGenericCategory<V>>(): DaffCategoryPageMemoizedSelectors<V> => {
                              const selectCategoryFeatureState = getDaffCategoryFeatureSelector<V>().selectCategoryFeatureState;
                            
                              const selectCategoryState = createSelector(
                                selectCategoryFeatureState,

                              Function $process has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                $process(docs: Document[]) {
                                  const docTypes = this.docTypes;
                                  docs.forEach((doc) => {
                                    if (docTypes.includes(doc.docType)) {
                                      const contents = doc.renderedContent || '';
                              Severity: Minor
                              Found in tools/dgeni/src/processors/convertToJson.ts - About 1 hr to fix

                                Function getMaxPricesForConfigurationIncludingOptionalItems has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function getMaxPricesForConfigurationIncludingOptionalItems(product: DaffCompositeProduct, appliedOptions: Dictionary<DaffCompositeProductItemOption>): DaffProductPrices {
                                  return {
                                    discountedPrice: product.items.reduce((acc, item) => daffAdd(
                                      acc,
                                      appliedOptionHasId(appliedOptions[item.id]) ?

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

                                const createCartItemEntitiesSelectors = <
                                  T extends DaffCart = DaffCart,
                                  V extends DaffCartOrderResult = DaffCartOrderResult,
                                  Configurable extends DaffConfigurableCartItem = DaffConfigurableCartItem,
                                  Composite extends DaffCompositeCartItem = DaffCompositeCartItem,

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

                                  static forRoot(): ModuleWithProviders<DaffRelatedProductsMagentoDriverModule> {
                                    return {
                                      ngModule: DaffRelatedProductsMagentoDriverModule,
                                      providers: [
                                        {

                                  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-0/src/order.service.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language