shopinvader/odoo-shopinvader

View on GitHub

Showing 49 of 117 total issues

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

    def _compute_url_key(self):
        for record in self:
            if not record.active:
                record.url_key = ""
            else:
Severity: Minor
Found in base_url/models/abstract_url.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 action_apply has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def action_apply(self):
        """
        Bind selected partners
        :return: dict
        """
Severity: Minor
Found in shopinvader/wizards/shopinvader_partner_binding_line.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

Avoid deeply nested control flow statements.
Open

                        if binding.sync_state == "done":
                            vals["sync_state"] = "to_update"
                        binding.write(vals)
Severity: Major
Found in shopinvader_product_stock/models/product_product.py - About 45 mins to fix

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

        def add_misssing_index(self):
            self.ensure_one()
            ir_models = self._get_default_models()
            index_obj = self.env["se.index"]
            ir_export_obj = self.env["ir.exports"]
    Severity: Minor
    Found in shopinvader_search_engine/models/shopinvader_backend.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 _redirect_record_to has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _redirect_record_to(self, records, dest_record):
            if dest_record in records:
                raise UserError(_(u"You can not redirect a record on itself"))
            for record in records:
                for binding in record.shopinvader_bind_ids:
    Severity: Minor
    Found in shopinvader/wizards/shopinvader_redirection_wizard.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 _get_selector_for_attribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_selector_for_attribute(self, attribute, selected_values):
            """This method return the attribute selector for the attribute
            For all value available for this attribute we search the variant that
            match this value and use it for filling the selector information
            """
    Severity: Minor
    Found in shopinvader_product_variant_selector/models/shopinvader_variant.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 action_request_quotation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def action_request_quotation(self):
            for cart in self:
                if cart.state == "draft" and cart.typology == "cart":
                    cart.typology = "quotation"
                    if cart.shopinvader_backend_id:
    Severity: Minor
    Found in shopinvader_quotation/models/sale.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 _get_price_per_qty has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_price_per_qty(self, qty, pricelist, fposition, company=None):
            product_id = self.record_id
            taxes = product_id.taxes_id.sudo().filtered(
                lambda r: not company or r.company_id == company
            )
    Severity: Minor
    Found in shopinvader/models/shopinvader_variant.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 _get_partner_from_headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_partner_from_headers(cls, headers):
            partner_model = request.env["shopinvader.partner"]
            partner_email = headers.get("HTTP_PARTNER_EMAIL")
            backend = cls._get_shopinvader_backend_from_request()
            if partner_email:
    Severity: Minor
    Found in shopinvader/controllers/main.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 _is_same_partner_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _is_same_partner_value(self, partner, vals):
            """ we check if one of the given value is different than values
                of the given partner
            """
            skip_keys = self._is_same_partner_value_skip_keys(partner)
    Severity: Minor
    Found in shopinvader/models/shopinvader_partner.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 _check_default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _check_default(self):
            """
            Check if there is only 1 default sale profile per backend.
            :return:
            """
    Severity: Minor
    Found in shopinvader_sale_profile/models/shopinvader_sale_profile.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 _compute_parent_category has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compute_parent_category(self):
            for record in self:
                for binding in record.parent_id.shopinvader_bind_ids:
                    if (
                        binding.backend_id == record.backend_id
    Severity: Minor
    Found in shopinvader/models/shopinvader_category.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 _compute_stock_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compute_stock_data(self):
            result = defaultdict(dict)
            for backend in self.mapped("backend_id"):
                for (
                    wh_key,
    Severity: Minor
    Found in shopinvader_product_stock/models/shopinvader_variant.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 _get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get(self, create_if_not_found=True):
            """
    
            :return: sale.order recordset (cart)
            """
    Severity: Minor
    Found in shopinvader/services/cart.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 country has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def country(self, record):
            res = {}
            for lang in record.lang_ids:
                res[lang.code[0:2]] = []
                for country in record.with_context(
    Severity: Minor
    Found in shopinvader_locomotive/component/mapper.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 _get_api_key_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_api_key_name(cls, auth_api_key):
            for section in serv_config.sections():
                if section.startswith("api_key_") and serv_config.has_option(
                    section, "key"
                ):
    Severity: Minor
    Found in shopinvader/models/shopinvader_backend.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 _onchange_shopinvader_backend_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _onchange_shopinvader_backend_id(self):
            """
            Onchange for the shopinvader_backend_id field.
            Auto fill some info based on active_ids and selected backend.
            :return:
    Severity: Minor
    Found in shopinvader/wizards/shopinvader_partner_binding.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_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compute_attributes(self):
            for record in self:
                attributes = {}
                for group in record.attribute_set_id.attribute_group_ids:
                    for attr in group.attribute_ids:
    Severity: Minor
    Found in shopinvader_custom_attribute/models/shopinvader_variant.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_real_level has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compute_real_level(self):
            """
            Compute the real_level.
            This function is recursive (depth depends on category depth).
            Each category real_sequence is based on the real_sequence of his
    Severity: Minor
    Found in shopinvader/models/shopinvader_category.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 _prepare_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _prepare_params(self, params):
            for key in ["country", "state"]:
                if key in params:
                    val = params.pop(key)
                    if val.get("id"):
    Severity: Minor
    Found in shopinvader/services/address.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