naoufal/react-native-apple-pay

View on GitHub

Showing 71 of 71 total issues

Method show has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

            ReadableMap paymentMethodData,
            ReadableMap details,
            ReadableMap options,
            Callback errorCallback,
            Callback successCallback

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

      _getPlatformDetailsIOS(details: PaymentDetailsIOSRaw): PaymentDetailsIOS {
        const {
          paymentData: serializedPaymentData,
          billingContact: serializedBillingContact,
          shippingContact: serializedShippingContact,
    Severity: Minor
    Found in js/PaymentRequest/index.js - 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 _handleUserAccept has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      _handleUserAccept(details: {
        transactionIdentifier: string,
        paymentData: string,
        shippingAddress: Object,
        payerEmail: string,
    Severity: Minor
    Found in js/PaymentRequest/index.js - 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 false;
    Severity: Major
    Found in js/PaymentRequest/helpers/index.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return true;
      Severity: Major
      Found in js/PaymentRequest/helpers/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return false;
        Severity: Major
        Found in js/PaymentRequest/helpers/index.js - About 30 mins to fix

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

          export function convertDetailAmountsToString(
            details: PaymentDetailsInit
          ): PaymentDetailsInit {
            const nextDetails = Object.keys(details).reduce((acc, key) => {
              if (key === 'total') {
          Severity: Minor
          Found in js/PaymentRequest/helpers/index.js - 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 updateWith has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            async updateWith(
              PaymentDetailsModifierOrPromise:
                | PaymentDetailsUpdate
                | ((
                    PaymentDetailsModifier,
          Severity: Minor
          Found in js/PaymentRequest/PaymentRequestUpdateEvent.js - 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

          Method show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              @ReactMethod
              public void show(
                      ReadableMap paymentMethodData,
                      ReadableMap details,
                      ReadableMap options,

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

          export function validateTotal(total, errorType = Error): void {
            // Should Vailidator take an errorType to prepopulate "Failed to construct 'PaymentRequest'"
          
            if (total === undefined) {
              throw new errorType(`required member total is undefined.`);
          Severity: Minor
          Found in js/PaymentRequest/helpers/index.js - 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 hasGatewayConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export function hasGatewayConfig(platformMethodData = {}) {
            if (!platformMethodData) {
              return false;
            }
          
          
          Severity: Minor
          Found in js/PaymentRequest/helpers/index.js - 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