Kinvey/js-sdk

View on GitHub

Showing 349 of 349 total issues

Avoid too many return statements within this function.
Open

        return new KinveyError(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 new ParameterValueOutOfRangeError(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 new KinveyError();
      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 await this.setAuthorization(KinveyHttpAuth.MFASessionToken);
        Severity: Major
        Found in packages/js-sdk/src/http/headers.ts - About 30 mins to fix

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

            async pullById(id: string, options: any = {}) {
              const network = new NetworkStore(this.collectionName);
              const cache = new DataStoreCache(this.collectionName, this.tag);
          
              // Push sync queue
          Severity: Minor
          Found in packages/js-sdk/src/datastore/cachestore.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 loginWithRedirectUri has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

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

          export async function register(options: PushNotificationOptions = {}): Promise<string> {
            const promise = new Promise<string>((resolve, reject): void => {
              RNPushNotification.configure({
                permissions: options.permissions,
                popInitialNotification: options.popInitialNotification,
          Severity: Minor
          Found in packages/react-native-sdk/src/push.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 byteCount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function byteCount(str: string): number {
            if (str) {
              let count = 0;
              const stringLength = str.length;
          
          
          Severity: Minor
          Found in packages/js-sdk/src/http/headers.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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            constructor(config: HttpResponseConfig) {
              this.statusCode = config.statusCode;
              this.headers = new HttpHeaders(config.headers);
          
              const contentType = this.headers.get('Content-Type') || '';
          Severity: Minor
          Found in packages/js-sdk/src/http/response.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