OCA/l10n-italy

View on GitHub

Showing 1,161 of 1,161 total issues

Avoid deeply nested control flow statements.
Open

                        if line.advance_customs_vat:
                            advance_customs_vat_line = True
                            break
                if not advance_customs_vat_line:
Severity: Major
Found in l10n_it_bill_of_entry/account_invoice.py - About 45 mins to fix

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

        def exist(self, cr, uid, field, value, id_doc, context=None):
    Severity: Minor
    Found in l10n_it_account/models/account_tax.py - About 45 mins to fix

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

          def _prepareRelDocsLine(self, invoice_id, line, type):
              res = []
              lineref = line.RiferimentoNumeroLinea or False
              IdDoc = line.IdDocumento or 'Error'
              Data = line.Data or False
      Severity: Minor
      Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.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 quant.qty >= 0:
                                  quants |= quant
                  weight = sum(l.product_id.weight * l.qty for l in quants)
      Severity: Major
      Found in l10n_it_ddt/models/stock_picking_package_preparation.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if fatturapa_atts:
                                    _logger.info("In invoice %s already processed"
                                                 % fatturapa_atts.mapped('name'))
                                else:
                                    fatturapa_attachment_in.create({
        Severity: Major
        Found in l10n_it_fatturapa_pec/models/mail_thread.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if boe_line.invoice_line_tax_id:
                                      if len(boe_line.invoice_line_tax_id) > 1:
                                          raise osv.except_osv(_('Error'),
                                              _("Can't handle more than 1 tax for line %s") % boe_line.name)
                                      tax_code_id = (boe_line.invoice_line_tax_id[0].base_code_id
          Severity: Major
          Found in l10n_it_bill_of_entry/account_invoice.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if tax_code_id:
                                        line_vals['tax_code_id'] = tax_code_id
                                        line_vals['tax_amount'] = boe_line.price_subtotal
                                    move_lines.append((0, 0, line_vals))
            Severity: Major
            Found in l10n_it_bill_of_entry/account_invoice.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if not dline.IstitutoFinanziario:
                                          self.log_inconsistency(
                                              _("Name of Bank with BIC '%s' is not set."
                                                " Can't create bank") % dline.BIC
                                          )
              Severity: Major
              Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if account_map.dest_account_id:
                                            dest_accounts_totals[account_map.dest_account_id.id] -= balance
                            accounts_done += 1
                Severity: Major
                Found in account_fiscal_year_closing/wizard/wizard_run.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if move_line.account_id.id == bill_of_entry.account_id.id:
                                              reconcile_ids.append(move_line.id)
                                              for boe_move_line in bill_of_entry.move_id.line_id:
                                                  if boe_move_line.account_id.id == bill_of_entry.account_id.id:
                                                      reconcile_ids.append(boe_move_line.id)
                  Severity: Major
                  Found in l10n_it_bill_of_entry/account_invoice.py - About 45 mins to fix

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

                        def _check_multiple_picking_ids(self):
                            for package in self:
                                if not package.ddt_type_id.restrict_pickings:
                                    continue
                                for picking in package.picking_ids:
                    Severity: Minor
                    Found in l10n_it_ddt/models/stock_picking_package_preparation.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 num_messages < MAX_POP_MESSAGES:
                                                    break
                                                pop_server.quit()
                    Severity: Major
                    Found in l10n_it_fatturapa_pec/models/fetchmail.py - About 45 mins to fix

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

                          def get_line_product(self, line, partner):
                              product = None
                              supplier_info = self.env['product.supplierinfo']
                              if len(line.CodiceArticolo) == 1:
                                  supplier_code = line.CodiceArticolo[0].CodiceValore
                      Severity: Minor
                      Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.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

                                                  for num in range(
                                                          1, min(MAX_POP_MESSAGES, num_messages) + 1
                                                  ):
                                                      (header, messages, octets) = pop_server.retr(
                                                          num)
                      Severity: Major
                      Found in l10n_it_fatturapa_pec/models/fetchmail.py - About 45 mins to fix

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

                            def _compute_total(self, cr, uid, ids, field_names, args, context=None):
                        Severity: Minor
                        Found in l10n_it_withholding_tax_payment/models/withholding_tax.py - About 45 mins to fix

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

                              def _compute_payable_vat_amount(
                          Severity: Minor
                          Found in account_vat_period_end_statement/models/account.py - About 45 mins to fix

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

                                def _get_account_vat_amounts(
                                    self, type='credit', statement_account_line=None, context=None
                                ):
                                    if context is None:
                                        context = {}
                            Severity: Minor
                            Found in account_vat_period_end_statement/report/vat_period_end_statement.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_undeductible_balances has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def get_undeductible_balances(self, tax):
                                    total_undeduct = 0
                                    total_deduct = 0
                                    if self.is_totally_undeductable(tax):
                                        total_undeduct = self.compute_tax_code_total(
                            Severity: Minor
                            Found in l10n_it_vat_registries/vat_registry.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

                                                    for wt_invoice_line in inv.withholding_tax_line.\
                                                            filtered(lambda x: x == wt_tax):
                                                        i += 1
                                                        if i == rate_num:
                                                            wt_amount = wt_residual
                            Severity: Major
                            Found in l10n_it_withholding_tax/models/voucher.py - About 45 mins to fix

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

                                  def _amount_residual(self, cr, uid, ids, name, args, context=None):
                              Severity: Minor
                              Found in account_vat_period_end_statement/models/account.py - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language