paypay/paypayopa-sdk-python

View on GitHub

Showing 11 of 48 total issues

Function create_qr_code has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def create_qr_code(self, data=None, **kwargs):
        if data is None:
            data = {}
        url = self.base_url
        if "requestedAt" not in data:
Severity: Minor
Found in paypayopa/resources/code.py - About 2 hrs 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 auth_header has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def auth_header(self, api_key, api_secret,
Severity: Minor
Found in paypayopa/client.py - About 45 mins to fix

    Function pre_authorize_create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def pre_authorize_create(self, data={}, **kwargs):
            url = "{}/{}".format(self.base_url, 'preauthorize')
            if "requestedAt" not in data:
                data['requestedAt'] = int(datetime.datetime.now().timestamp())
            if "merchantPaymentId" not in data:
    Severity: Minor
    Found in paypayopa/resources/preauth.py - About 45 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 capture_payment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def capture_payment(self, data=None, **kwargs):
            if data is None:
                data = {}
            url = "{}/{}".format('/v2/payments', 'capture')
            if "requestedAt" not in data:
    Severity: Minor
    Found in paypayopa/resources/payment.py - About 45 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 encode_jwt has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def encode_jwt(self, secret=str, scope="direct_debit",
    Severity: Minor
    Found in paypayopa/client.py - About 45 mins to fix

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

          def create_continuous_payment(self, data=None, **kwargs):
              if data is None:
                  data = {}
              url = "{}/{}".format('/v1/subscription', 'payments')
              if "requestedAt" not in data:
      Severity: Minor
      Found in paypayopa/resources/payment.py - 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 give_cashback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def give_cashback(self, data=None, **kwargs):
              if data is None:
                  data = {}
              url = "{}".format(self.give_base_url)
              if "merchantCashbackId" not in data:
      Severity: Minor
      Found in paypayopa/resources/cashback.py - 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 refund_payment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def refund_payment(self, data={}, **kwargs):
              url = "{}/".format('/v2/refunds')
              if "requestedAt" not in data:
                  data['requestedAt'] = int(datetime.datetime.now().timestamp())
              if "merchantRefundId" not in data:
      Severity: Minor
      Found in paypayopa/resources/payment.py - 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 reverse_cashback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def reverse_cashback(self, data=None, **kwargs):
              if data is None:
                  data = {}
              url = "{}".format(self.reverse_base_url)
              if "merchantCashbackReversalId" not in data:
      Severity: Minor
      Found in paypayopa/resources/cashback.py - 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 create_pending_payment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_pending_payment(self, data={}, **kwargs):
              url = self.base_url
              if "requestedAt" not in data:
                  data['requestedAt'] = int(datetime.datetime.now().timestamp())
              if "merchantPaymentId" not in data:
      Severity: Minor
      Found in paypayopa/resources/pending.py - 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 refund_payment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def refund_payment(self, data={}, **kwargs):
              url = "{}".format(URL.REFUNDS)
              if "merchantRefundId" not in data:
                  raise ValueError("\x1b[31m MISSING REQUEST PARAMS "
                                   "\x1b[0m for merchantRefundId")
      Severity: Minor
      Found in paypayopa/resources/pending.py - 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