BetterTyped/hyper-fetch

View on GitHub

Showing 248 of 345 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  onDownloadProgressById: <T extends RequestInstance = RequestInstance>(
    requestId: string,
    callback: (values: ProgressType, details: RequestEventType<T>) => void,
  ): VoidFunction => {
    emitter.on(getDownloadProgressIdEventKey(requestId), callback);
packages/core/src/managers/request/request.manager.events.ts on lines 144..150
packages/core/src/managers/request/request.manager.events.ts on lines 151..157

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 98.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function realtimeSockets has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const realtimeSockets = (database: Database): RealtimeSocketAdapterType => {
  return (socket) => {
    const {
      open,
      connecting,
Severity: Major
Found in packages/adapter-firebase/src/realtime/realtime.sockets.ts - About 3 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    export const getOrderedResultFirestore = (snapshot: any) => {
      const result = [];
      snapshot.docs.forEach((d) => {
        result.push({ ...d.data(), __key: d.id });
      });
    packages/adapter-firebase-admin/src/firestore/utils/result.utils.ts on lines 1..7

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 97.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    export const getOrderedResultFirestore = (snapshot: any) => {
      const result = [];
      snapshot.docs.forEach((d) => {
        result.push({ ...d.data(), __key: d.id });
      });
    packages/adapter-firebase/src/firestore/utils/result.utils.ts on lines 1..7

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 97.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function realtimeSocketsAdmin has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const realtimeSocketsAdmin = (database: Database): RealtimeAdminSocketAdapterType => {
      return (socket) => {
        const {
          open,
          connecting,
    Severity: Major
    Found in packages/adapter-firebase-admin/src/realtime/realtime.sockets.ts - About 3 hrs to fix

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        removeOnSuccessInterceptors = (
          callbacks: ResponseInterceptorType<any, null | GlobalErrorType, Adapter>[],
        ): Client<GlobalErrorType, Adapter, EndpointMapper> => {
          this.__onSuccessCallbacks = this.__onSuccessCallbacks.filter((callback) => !callbacks.includes(callback));
          return this;
      Severity: Major
      Found in packages/core/src/client/client.ts and 2 other locations - About 2 hrs to fix
      packages/core/src/client/client.ts on lines 290..295
      packages/core/src/client/client.ts on lines 348..353

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 94.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        removeOnResponseInterceptors = (
          callbacks: ResponseInterceptorType<any, null | GlobalErrorType, Adapter>[],
        ): Client<GlobalErrorType, Adapter, EndpointMapper> => {
          this.__onResponseCallbacks = this.__onResponseCallbacks.filter((callback) => !callbacks.includes(callback));
          return this;
      Severity: Major
      Found in packages/core/src/client/client.ts and 2 other locations - About 2 hrs to fix
      packages/core/src/client/client.ts on lines 290..295
      packages/core/src/client/client.ts on lines 310..315

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 94.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        removeOnErrorInterceptors = (
          callbacks: ResponseInterceptorType<any, null | GlobalErrorType, Adapter>[],
        ): Client<GlobalErrorType, Adapter, EndpointMapper> => {
          this.__onErrorCallbacks = this.__onErrorCallbacks.filter((callback) => !callbacks.includes(callback));
          return this;
      Severity: Major
      Found in packages/core/src/client/client.ts and 2 other locations - About 2 hrs to fix
      packages/core/src/client/client.ts on lines 310..315
      packages/core/src/client/client.ts on lines 348..353

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 94.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export const $where = (fieldPath: string, opStr: WhereFilterOp, value: any) => {
        return {
          toString: () => `${FirestoreQueryConstraints.WHERE}_${fieldPath}${opStr}${value}`,
          type: FirestoreQueryConstraints.WHERE as const,
          values: [fieldPath, opStr, value],
      packages/adapter-firebase-admin/src/constraints/firebase.constraints.ts on lines 24..30

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 93.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export const $where = (fieldPath: string, opStr: WhereFilterOp, value: any) => {
        return {
          toString: () => `${FirestoreQueryConstraints.WHERE}_${fieldPath}${opStr}${value}`,
          type: FirestoreQueryConstraints.WHERE as const,
          values: [fieldPath, opStr, value],
      packages/adapter-firebase/src/constraints/firebase.constraints.ts on lines 24..30

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 93.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      export const getOrderedResultRealtime = (snapshot: any) => {
        const res = [];
        snapshot.forEach((child) => {
          res.push({ ...child.val(), __key: child.key });
        });
      packages/adapter-firebase/src/realtime/utils/result.utils.ts on lines 1..7

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 93.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      export const getOrderedResultRealtime = (snapshot: any) => {
        const res = [];
        snapshot.forEach((child) => {
          res.push({ ...child.val(), __key: child.key });
        });
      Severity: Major
      Found in packages/adapter-firebase/src/realtime/utils/result.utils.ts and 1 other location - About 2 hrs to fix
      packages/adapter-firebase-admin/src/realtime/utils/result.utils.ts on lines 1..7

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 93.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function adapter has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const adapter: AdapterType = async (request, requestId) => {
        const {
          makeRequest,
          fullUrl,
          config,
      Severity: Major
      Found in packages/core/src/adapter/adapter.server.ts - About 2 hrs to fix

        Function adapter has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const adapter: GraphQLAdapterType = async (request, requestId) => {
          const {
            makeRequest,
            config,
            headers,
        Severity: Major
        Found in packages/adapter-graphql/src/adapter/adapter.server.ts - About 2 hrs to fix

          Function firestoreAdminSockets has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const firestoreAdminSockets = (database: Firestore): FirestoreAdminSocketAdapterType => {
            return (socket) => {
              const {
                open,
                connecting,
          Severity: Major
          Found in packages/adapter-firebase-admin/src/firestore/firestore.sockets.ts - About 2 hrs to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            export type RealtimeDbAdapterType =
              | AdapterType<
                  DefaultRealtimeDBAdapterOptions,
                  "get",
                  RealtimeDBStatuses,
            packages/adapter-firebase-admin/src/adapter/types/adapter.realtime.types.ts on lines 18..39

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 90.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            export type RealtimeDbAdapterType =
              | AdapterType<
                  DefaultRealtimeDBAdapterOptions,
                  "get",
                  RealtimeDBStatuses,
            packages/adapter-firebase/src/adapter/types/adapter.realtime.types.ts on lines 18..39

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 90.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              onResponseStart: <T extends RequestInstance>(
                queueKey: string,
                callback: (details: RequestEventType<T>) => void,
              ): VoidFunction => {
                emitter.on(getResponseStartEventKey(queueKey), callback);
            Severity: Major
            Found in packages/core/src/managers/request/request.manager.events.ts and 1 other location - About 2 hrs to fix
            packages/core/src/managers/request/request.manager.events.ts on lines 106..112

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 89.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              onRequestStart: <T extends RequestInstance>(
                queueKey: string,
                callback: (details: RequestEventType<T>) => void,
              ): VoidFunction => {
                emitter.on(getRequestStartEventKey(queueKey), callback);
            Severity: Major
            Found in packages/core/src/managers/request/request.manager.events.ts and 1 other location - About 2 hrs to fix
            packages/core/src/managers/request/request.manager.events.ts on lines 121..127

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 89.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              onRemoveById: <T extends RequestInstance = RequestInstance>(
                requestId: string,
                callback: (details: RequestEventType<T>) => void,
              ): VoidFunction => {
                emitter.on(getRemoveIdEventKey(requestId), callback);
            Severity: Major
            Found in packages/core/src/managers/request/request.manager.events.ts and 1 other location - About 2 hrs to fix
            packages/core/src/managers/request/request.manager.events.ts on lines 194..200

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language