OCA/account-fiscal-rule

View on GitHub

Showing 13 of 31 total issues

Function find_or_create has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def find_or_create(self, company_id, sale_tax_ids, purchase_tax_ids):
        at_obj = self.env['account.tax']
        # Search for existing Fiscal Classification

        fcs = self.search(

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

    def action_create(self):
        obj_tax = self.env['account.tax']
        obj_tax_template = self.env['account.tax.template']
        obj_fc = self.env['account.product.fiscal.classification']
        obj_fc_template = self.env[

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

    def generate_eu_oss_taxes(self):
        oss_rate = self.env["oss.tax.rate"]
        account_tax = self.env["account.tax"]
        selected_taxes = []
        fpos_obj = self.env["account.fiscal.position"]
Severity: Minor
Found in l10n_eu_oss/wizard/l10n_eu_oss_wizard.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

Consider simplifying this complex logical expression.
Open

        if len(sale_tax_ids) == 0 and len(purchase_tax_ids) == 0:
            name = _('No taxes')
        elif len(purchase_tax_ids) == 0:
            name = _('No Purchase Taxes - Sale Taxes: ')
            for tax in at_obj.browse(sale_tax_ids):

    Function fields_view_get has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def fields_view_get(
    Severity: Major
    Found in account_product_fiscal_classification/models/product_template.py - About 50 mins to fix

      Function _get_invoice_vals has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _get_invoice_vals(self, cr, uid, key, inv_type, journal_id, move,
      Severity: Major
      Found in account_fiscal_position_rule_stock/models/stock_picking.py - About 50 mins to fix

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

            def fiscal_position_map(self, **kwargs):
                result = {'fiscal_position': False}
        
                partner_id = kwargs.get('partner_id')
                company_id = kwargs.get('company_id')
        Severity: Minor
        Found in account_fiscal_position_rule/models/account_fiscal_position_rule.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 _template_vals has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _template_vals(self, cr, uid, template, company_id,
        Severity: Minor
        Found in account_fiscal_position_rule/models/account_fiscal_position_rule.py - About 45 mins to fix

          Function onchange_partner_id has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def onchange_partner_id(self, type, partner_id, date_invoice=False,
          Severity: Minor
          Found in account_fiscal_position_rule/models/account_invoice.py - About 45 mins to fix

            Function onchange_company_id has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def onchange_company_id(self, company_id, part_id, type,
            Severity: Minor
            Found in account_fiscal_position_rule/models/account_invoice.py - About 35 mins to fix

              Function search has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def search(self, args, offset=0, limit=None, order=None, count=False):
              Severity: Minor
              Found in account_fiscal_position_partner_type/models/account_fiscal_position.py - About 35 mins to fix

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

                def create_fiscal_classification_from_product_template(cr, registry):
                    """Generate Fiscal Classification for each combinations of Taxes set
                    in product"""
                    env = api.Environment(cr, SUPERUSER_ID, {})
                
                
                Severity: Minor
                Found in account_product_fiscal_classification/__init__.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 action_create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def action_create(self):
                        obj_fpr_temp = self.env['account.fiscal.position.rule.template']
                        company_id = self.company_id.id
                
                        fsc_rule_template = obj_fpr_temp.search([])
                Severity: Minor
                Found in account_fiscal_position_rule/models/account_fiscal_position_rule.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