shopinvader/odoo-shopinvader-payment

View on GitHub

Showing 7 of 25 total issues

Function _inverse_paypal_profile_info has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _inverse_paypal_profile_info(self):
        paypal = self._get_paypal_api()
        for record in self:
            if not record.paypal_profile_info:
                continue
Severity: Minor
Found in shopinvader_payment_paypal/models/shopinvader_payment.py - About 1 hr 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 _process_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _process_response(self, **params):
        INVALID_DATA = _("invalid data")
        data = params.get("Data")
        seal = params.get("Seal")
        if not data or not seal:
Severity: Minor
Found in invader_payment_sips/services/payment_sips.py - About 1 hr 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 prepare_payment has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def prepare_payment(
Severity: Minor
Found in invader_payment_sips/services/payment_sips.py - About 35 mins to fix

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

        def confirm_payment(self, target, **params):
            """
            This is the rest service exposed to locomotive and called on
            payment confirmation.
            The steps here depend on how the card is managed on Stripe side.
    Severity: Minor
    Found in invader_payment_stripe/services/payment_stripe.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 _generate_stripe_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _generate_stripe_response(self, intent, payable, target, **params):
            """
            This is the message returned to client
            :param intent: StripeIntent (None means error)
            :param payable: invader.payable record
    Severity: Minor
    Found in invader_payment_stripe/services/payment_stripe.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 _invader_find_payable_from_target has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _invader_find_payable_from_target(self, target, **params):
            if target == "quotation":
                quotation_id = params.get("quotation_id")
                if not quotation_id:
                    raise UserError(_("Quotation id is missing"))
    Severity: Minor
    Found in shopinvader_quotation_payment/services/invader_payment_service.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 _compute_reference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compute_reference(self, values=None, prefix=None):
            """Compute a unique reference for the transaction.
            If prefix:
                prefix-d+
            If some invoices:
    Severity: Minor
    Found in invader_payment/models/payment_transaction.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