Kinvey/js-sdk

View on GitHub

Showing 349 of 349 total issues

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

export class IncompleteRequestBodyError extends KinveyError {
  constructor(message = 'The request body is either missing or incomplete.', debug?: string) {
    super(message, debug);
    this.name = 'IncompleteRequestBodyError';
  }
Severity: Major
Found in packages/js-sdk/src/errors/incompleteRequestBody.ts and 36 other locations - About 40 mins to fix
packages/js-sdk/src/errors/activeUser.ts on lines 3..8
packages/js-sdk/src/errors/apiVersionNotAvailable.ts on lines 3..8
packages/js-sdk/src/errors/apiVersionNotImplemented.ts on lines 3..8
packages/js-sdk/src/errors/appProblem.ts on lines 3..8
packages/js-sdk/src/errors/badRequest.ts on lines 3..8
packages/js-sdk/src/errors/bl.ts on lines 3..8
packages/js-sdk/src/errors/corsDisabled.ts on lines 3..8
packages/js-sdk/src/errors/duplicateEndUsers.ts on lines 3..8
packages/js-sdk/src/errors/featureUnavailable.ts on lines 3..8
packages/js-sdk/src/errors/indirectCollectionAccessDisallowed.ts on lines 3..8
packages/js-sdk/src/errors/insufficientCredentials.ts on lines 3..8
packages/js-sdk/src/errors/invalidCredentials.ts on lines 3..8
packages/js-sdk/src/errors/invalidIdentifier.ts on lines 3..8
packages/js-sdk/src/errors/invalidQuerySyntax.ts on lines 3..8
packages/js-sdk/src/errors/jsonParse.ts on lines 3..8
packages/js-sdk/src/errors/kinveyInternalErrorRetry.ts on lines 3..8
packages/js-sdk/src/errors/kinveyInternalErrorStop.ts on lines 3..8
packages/js-sdk/src/errors/missingConfiguration.ts on lines 3..8
packages/js-sdk/src/errors/missingQuery.ts on lines 3..8
packages/js-sdk/src/errors/missingRequestHeader.ts on lines 3..8
packages/js-sdk/src/errors/missingRequestParameter.ts on lines 3..8
packages/js-sdk/src/errors/mobileIdentityConnect.ts on lines 3..8
packages/js-sdk/src/errors/network.ts on lines 3..8
packages/js-sdk/src/errors/noActiveUser.ts on lines 3..8
packages/js-sdk/src/errors/noResponse.ts on lines 3..8
packages/js-sdk/src/errors/notFound.ts on lines 3..8
packages/js-sdk/src/errors/parameterValueOutOfRange.ts on lines 3..8
packages/js-sdk/src/errors/popup.ts on lines 3..8
packages/js-sdk/src/errors/query.ts on lines 3..8
packages/js-sdk/src/errors/resultSetSizeExceeded.ts on lines 3..8
packages/js-sdk/src/errors/server.ts on lines 3..8
packages/js-sdk/src/errors/staleRequest.ts on lines 3..8
packages/js-sdk/src/errors/sync.ts on lines 3..8
packages/js-sdk/src/errors/timeout.ts on lines 3..8
packages/js-sdk/src/errors/userAlreadyExists.ts on lines 3..8
packages/js-sdk/src/errors/writesToCollectionDisallowed.ts on lines 3..8

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 48.

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 37 locations. Consider refactoring.
Open

export class NoResponseError extends KinveyError {
  constructor(message = 'No response was provided.', debug?: string) {
    super(message, debug);
    this.name = 'NoResponseError';
  }
Severity: Major
Found in packages/js-sdk/src/errors/noResponse.ts and 36 other locations - About 40 mins to fix
packages/js-sdk/src/errors/activeUser.ts on lines 3..8
packages/js-sdk/src/errors/apiVersionNotAvailable.ts on lines 3..8
packages/js-sdk/src/errors/apiVersionNotImplemented.ts on lines 3..8
packages/js-sdk/src/errors/appProblem.ts on lines 3..8
packages/js-sdk/src/errors/badRequest.ts on lines 3..8
packages/js-sdk/src/errors/bl.ts on lines 3..8
packages/js-sdk/src/errors/corsDisabled.ts on lines 3..8
packages/js-sdk/src/errors/duplicateEndUsers.ts on lines 3..8
packages/js-sdk/src/errors/featureUnavailable.ts on lines 3..8
packages/js-sdk/src/errors/incompleteRequestBody.ts on lines 3..8
packages/js-sdk/src/errors/indirectCollectionAccessDisallowed.ts on lines 3..8
packages/js-sdk/src/errors/insufficientCredentials.ts on lines 3..8
packages/js-sdk/src/errors/invalidCredentials.ts on lines 3..8
packages/js-sdk/src/errors/invalidIdentifier.ts on lines 3..8
packages/js-sdk/src/errors/invalidQuerySyntax.ts on lines 3..8
packages/js-sdk/src/errors/jsonParse.ts on lines 3..8
packages/js-sdk/src/errors/kinveyInternalErrorRetry.ts on lines 3..8
packages/js-sdk/src/errors/kinveyInternalErrorStop.ts on lines 3..8
packages/js-sdk/src/errors/missingConfiguration.ts on lines 3..8
packages/js-sdk/src/errors/missingQuery.ts on lines 3..8
packages/js-sdk/src/errors/missingRequestHeader.ts on lines 3..8
packages/js-sdk/src/errors/missingRequestParameter.ts on lines 3..8
packages/js-sdk/src/errors/mobileIdentityConnect.ts on lines 3..8
packages/js-sdk/src/errors/network.ts on lines 3..8
packages/js-sdk/src/errors/noActiveUser.ts on lines 3..8
packages/js-sdk/src/errors/notFound.ts on lines 3..8
packages/js-sdk/src/errors/parameterValueOutOfRange.ts on lines 3..8
packages/js-sdk/src/errors/popup.ts on lines 3..8
packages/js-sdk/src/errors/query.ts on lines 3..8
packages/js-sdk/src/errors/resultSetSizeExceeded.ts on lines 3..8
packages/js-sdk/src/errors/server.ts on lines 3..8
packages/js-sdk/src/errors/staleRequest.ts on lines 3..8
packages/js-sdk/src/errors/sync.ts on lines 3..8
packages/js-sdk/src/errors/timeout.ts on lines 3..8
packages/js-sdk/src/errors/userAlreadyExists.ts on lines 3..8
packages/js-sdk/src/errors/writesToCollectionDisallowed.ts on lines 3..8

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 48.

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 37 locations. Consider refactoring.
Open

export class BLError extends KinveyError {
  constructor(message = 'The Business Logic script did not complete.', debug?: string) {
    super(message, debug);
    this.name = 'BLError';
  }
Severity: Major
Found in packages/js-sdk/src/errors/bl.ts and 36 other locations - About 40 mins to fix
packages/js-sdk/src/errors/activeUser.ts on lines 3..8
packages/js-sdk/src/errors/apiVersionNotAvailable.ts on lines 3..8
packages/js-sdk/src/errors/apiVersionNotImplemented.ts on lines 3..8
packages/js-sdk/src/errors/appProblem.ts on lines 3..8
packages/js-sdk/src/errors/badRequest.ts on lines 3..8
packages/js-sdk/src/errors/corsDisabled.ts on lines 3..8
packages/js-sdk/src/errors/duplicateEndUsers.ts on lines 3..8
packages/js-sdk/src/errors/featureUnavailable.ts on lines 3..8
packages/js-sdk/src/errors/incompleteRequestBody.ts on lines 3..8
packages/js-sdk/src/errors/indirectCollectionAccessDisallowed.ts on lines 3..8
packages/js-sdk/src/errors/insufficientCredentials.ts on lines 3..8
packages/js-sdk/src/errors/invalidCredentials.ts on lines 3..8
packages/js-sdk/src/errors/invalidIdentifier.ts on lines 3..8
packages/js-sdk/src/errors/invalidQuerySyntax.ts on lines 3..8
packages/js-sdk/src/errors/jsonParse.ts on lines 3..8
packages/js-sdk/src/errors/kinveyInternalErrorRetry.ts on lines 3..8
packages/js-sdk/src/errors/kinveyInternalErrorStop.ts on lines 3..8
packages/js-sdk/src/errors/missingConfiguration.ts on lines 3..8
packages/js-sdk/src/errors/missingQuery.ts on lines 3..8
packages/js-sdk/src/errors/missingRequestHeader.ts on lines 3..8
packages/js-sdk/src/errors/missingRequestParameter.ts on lines 3..8
packages/js-sdk/src/errors/mobileIdentityConnect.ts on lines 3..8
packages/js-sdk/src/errors/network.ts on lines 3..8
packages/js-sdk/src/errors/noActiveUser.ts on lines 3..8
packages/js-sdk/src/errors/noResponse.ts on lines 3..8
packages/js-sdk/src/errors/notFound.ts on lines 3..8
packages/js-sdk/src/errors/parameterValueOutOfRange.ts on lines 3..8
packages/js-sdk/src/errors/popup.ts on lines 3..8
packages/js-sdk/src/errors/query.ts on lines 3..8
packages/js-sdk/src/errors/resultSetSizeExceeded.ts on lines 3..8
packages/js-sdk/src/errors/server.ts on lines 3..8
packages/js-sdk/src/errors/staleRequest.ts on lines 3..8
packages/js-sdk/src/errors/sync.ts on lines 3..8
packages/js-sdk/src/errors/timeout.ts on lines 3..8
packages/js-sdk/src/errors/userAlreadyExists.ts on lines 3..8
packages/js-sdk/src/errors/writesToCollectionDisallowed.ts on lines 3..8

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 48.

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 loginWithMFA has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  username: string,
  password: string,
  selectAuthenticator: (authenticators: object[], context: MFAContext) => Promise<string>,
  mfaComplete: (authenticator: string, context: MFAContext) => Promise<MFACompleteResult>,
  options: LoginOptions = {}
Severity: Minor
Found in packages/js-sdk/src/user/loginWithMFA.ts - About 35 mins to fix

    Function _loginWithMFA has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      username: string,
      password: string,
      selectAuthenticator: (authenticators: object[], context: MFAContext) => Promise<string>,
      mfaComplete: (authenticator: string, context: MFAContext) => Promise<MFACompleteResult>,
      options: LoginOptions = {}
    Severity: Minor
    Found in packages/js-sdk/src/user/loginWithMFA.ts - About 35 mins to fix

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

          const indexedDB = window.indexedDB || (window as any).webkitIndexedDB || (window as any).mozIndexedDB || (window as any).msIndexedDB;
      Severity: Minor
      Found in packages/html5-sdk/src/storage/indexeddb.ts and 1 other location - About 35 mins to fix
      packages/html5-sdk/src/storage/indexeddb.ts on lines 308..308

      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 47.

      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

              const {
                rawResponse = false,
                timeout,
                properties,
                trace,
      Severity: Minor
      Found in packages/js-sdk/src/datastore/networkstore.ts and 1 other location - About 35 mins to fix
      packages/js-sdk/src/datastore/networkstore.ts on lines 163..171

      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 47.

      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

                const {
                  rawResponse = false,
                  timeout,
                  properties,
                  trace,
      Severity: Minor
      Found in packages/js-sdk/src/datastore/networkstore.ts and 1 other location - About 35 mins to fix
      packages/js-sdk/src/datastore/networkstore.ts on lines 55..63

      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 47.

      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

        isGloballyReadable() {
          return (this.entity._acl && this.entity._acl.gr === true) || false;
        }
      Severity: Minor
      Found in packages/js-sdk/src/acl.ts and 1 other location - About 35 mins to fix
      packages/js-sdk/src/acl.ts on lines 188..190

      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 47.

      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

          const indexedDB = window.indexedDB || (window as any).webkitIndexedDB || (window as any).mozIndexedDB || (window as any).msIndexedDB;
      Severity: Minor
      Found in packages/html5-sdk/src/storage/indexeddb.ts and 1 other location - About 35 mins to fix
      packages/html5-sdk/src/storage/indexeddb.ts on lines 56..56

      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 47.

      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

        isGloballyWritable() {
          return (this.entity._acl && this.entity._acl.gw === true) || false;
        }
      Severity: Minor
      Found in packages/js-sdk/src/acl.ts and 1 other location - About 35 mins to fix
      packages/js-sdk/src/acl.ts on lines 179..181

      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 47.

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

      export async function loginWithMICUsingResourceOwnerCredentials(username: string, password: string, options: MICOptions = {}) {
        const activeUser = await getActiveUser();
        const { micId } = options;
        let clientId = getAppKey();
      
      
      Severity: Minor
      Found in packages/js-sdk/src/user/loginWithMICUsingResourceOwnerCredentials.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 addSyncEvent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        async addSyncEvent(event: SyncEvent, docs: any) {
          const syncCache = new SyncCache(this.tag);
          let singular = false;
          let syncDocs: any = [];
          let docsToSync = docs;
      Severity: Minor
      Found in packages/js-sdk/src/datastore/sync.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 addFilter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        addFilter(field: string, ...args: any) {
          if (!isString(field)) {
            throw new QueryError('The field argument must be a string.');
          }
      
      
      Severity: Minor
      Found in packages/js-sdk/src/query.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 send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export async function send(request: any) {
        const { url, method, headers, body, timeout } = request;
        let response;
      
        // Add kinvey device information headers
      Severity: Minor
      Found in packages/html5-sdk/src/httpAdapter.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 group has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        group(aggregation: Aggregation, options: any = {}) {
          const stream = Observable.create(async (observer: any) => {
            try {
              if (!(aggregation instanceof Aggregation)) {
                throw new KinveyError('Invalid aggregation. It must be an instance of the Aggregation class.');
      Severity: Minor
      Found in packages/js-sdk/src/datastore/networkstore.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 lookup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export function lookup(query?: Query, options: LookupOptions = {}) {
        const stream = Observable.create(async (observer: any) => {
          try {
            if (query && !(query instanceof Query)) {
              throw new KinveyError('Invalid query. It must be an instance of the Query class.');
      Severity: Minor
      Found in packages/js-sdk/src/user/lookup.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 join has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        private join(operator: string, queries: any) {
          // Cast, validate, and parse arguments. If `queries` are supplied, obtain
          // the `filter` for joining. The eventual return function will be the
          // current query.
          let result = new Query(this);
      Severity: Minor
      Found in packages/js-sdk/src/query.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 new BLError(message, debug);
      Severity: Major
      Found in packages/js-sdk/src/http/response.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return null;
        Severity: Major
        Found in packages/js-sdk/src/http/response.ts - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language