graycoreio/daffodil

View on GitHub

Showing 122 of 124 total issues

Function daffStatusMixin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function
daffStatusMixin<T extends Constructor<HasElementRef>>(Base: T, defaultStatus?: DaffStatus) {
  class DaffStatusMixinClass extends Base {
    // TODO move this back to private in Typescript 3.1
    _status: DaffStatus;
Severity: Minor
Found in libs/design/src/core/statusable/statusable-mixin.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 daffTextAlignmentMixin has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function
daffTextAlignmentMixin<T extends Constructor<HasElementRef>>(Base: T, defaultTextAlignment?: DaffTextAlignment) {
  class DaffTextAlignableMixin extends Base {
    // TODO move this back to private in Typescript 3.1
    _textAlignment: DaffTextAlignment;
Severity: Minor
Found in libs/design/src/core/text-alignable/text-alignable-mixin.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 transformMagentoCartGraphQlError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function transformMagentoCartGraphQlError(error: GraphQLError, requestPayload?: unknown): DaffError {
  // TODO: readdress this when we move to eslint
  // eslint-disable-next-line
  for (const code in DaffCartMagentoErrorMessageRegexMap) {
    const matchIndex = error.message.search(DaffCartMagentoErrorMessageRegexMap[code]);
Severity: Minor
Found in libs/cart/driver/magento/src/errors/transform.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 _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

Avoid too many return statements within this function.
Open

    return 'closed';
Severity: Major
Found in libs/design/sidebar/src/animation/sidebar-animation-state.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return this.sendResetEmail(reqInfo);
    Severity: Major
    Found in libs/auth/driver/in-memory/src/backend/auth.service.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return 'open';
      Severity: Major
      Found in libs/design/sidebar/src/animation/sidebar-animation-state.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return 'under-closed';
        Severity: Major
        Found in libs/design/sidebar/src/animation/sidebar-animation-state.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return this.categoryTestingService.get(reqInfo);
          Severity: Major
          Found in apps/demo/src/app/drivers/in-memory/backend/backend.service.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return this.resetPassword(reqInfo);
            Severity: Major
            Found in libs/auth/driver/in-memory/src/backend/auth.service.ts - About 30 mins to fix

              Function traverseRouteTree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const traverseRouteTree = (routes: Routes = [], matcher: (route: Route) => boolean, operate: RouteOperator): Routes => {
                if(routes.length === 0) {
                  return routes;
                }
              
              
              Severity: Minor
              Found in libs/external-router/src/router/strategies/insert-data-path.ts - About 25 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 isOpening has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const isOpening = (fromState: DaffSidebarAnimationState, toState: DaffSidebarAnimationState): boolean => {
                if(fromState === 'under-open' && toState === 'open' || fromState === 'open' && toState === 'under-open') {
                  return false;
                }
              
              
              Severity: Minor
              Found in libs/design/sidebar/src/sidebar/is-opening.ts - About 25 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 validateGetBlocksResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const validateGetBlocksResponse = (response: ApolloQueryResult<MagentoGetBlocksResponse>) => {
                if (response.data?.cmsBlocks?.items) {
                  if (response.data.cmsBlocks.items.reduce((acc, block) => acc && !!(
                    block.identifier
                      && block.content
              Severity: Minor
              Found in libs/content/driver/magento/src/validators/get-blocks.ts - About 25 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 getVariables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                private getVariables(options: DaffSearchProductDriverOptions = {}) {
                  const queryVariables = {
                    filter: this.productFilterRequestsTransformer.transform(options.filterRequests),
                  };
                  if (options.pageSize || options.limit) {
              Severity: Minor
              Found in libs/search-product/driver/magento/src/product-search.service.ts - About 25 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 post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                post(reqInfo) {
                  if (reqInfo.id === 'login') {
                    return this.login(reqInfo);
                  } else if (reqInfo.id === 'register') {
                    return this.register(reqInfo);
              Severity: Minor
              Found in libs/auth/driver/in-memory/src/backend/auth.service.ts - About 25 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 daffCompactableMixin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export function
              daffCompactableMixin<T extends Constructor<HasElementRef>>(Base: T, defaultCompact: boolean = false) {
                return class extends Base {
                  // TODO move this back to private in Typescript 3.1
                  _compact: boolean;
              Severity: Minor
              Found in libs/design/src/core/compactable/compactable-mixin.ts - About 25 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 ngOnChanges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                ngOnChanges(changes: SimpleChanges): void {
                  if(!changes.tree.currentValue) {
                    this._tree = undefined;
                    this.flatTree = [];
                    return;
              Severity: Minor
              Found in libs/design/tree/src/tree/tree.component.ts - About 25 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 validateGetOrdersResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const validateGetOrdersResponse = (response: ApolloQueryResult<MagentoGetGuestOrdersResponse>) => {
                if (response.data?.graycoreGuestOrders?.items) {
                  if (response.data.graycoreGuestOrders.items.reduce((acc, order) => acc && !!(
                    order.billing_address
                      && order.shipping_address
              Severity: Minor
              Found in libs/order/driver/magento/2-4-1/src/validators/get-orders.ts - About 25 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 validateGetOrdersResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export const validateGetOrdersResponse = (response: ApolloQueryResult<MagentoGetGuestOrdersResponse>) => {
                if (response.data?.graycoreGuestOrders?.orders) {
                  if (response.data.graycoreGuestOrders.orders.reduce((acc, order) => acc && !!(
                    order.billing_address
                      && order.shipping_address
              Severity: Minor
              Found in libs/order/driver/magento/2-4-0/src/validators/get-orders.ts - About 25 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