OCA/l10n-italy

View on GitHub

Showing 341 of 1,161 total issues

Function _tax_amounts_by_tax_id has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def _tax_amounts_by_tax_id(self, move):
        res = {}
        tax_obj = self.pool.get('account.tax')
        for move_line in move.line_id:
            if (
Severity: Minor
Found in l10n_it_vat_registries/vat_registry.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 CreateFromDocument has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def CreateFromDocument(xml_string):
    try:
        root = etree.fromstring(xml_string)
    except Exception as e:
        _logger.warn('lxml was unable to parse xml: %s' % e)
Severity: Minor
Found in l10n_it_fatturapa/bindings/fatturapa.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 importFatturaPA has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def importFatturaPA(self):
        fatturapa_attachment_obj = self.env['fatturapa.attachment.in']
        fatturapa_attachment_ids = self.env.context.get('active_ids', False)
        invoice_model = self.env['account.invoice']
        new_invoices = []
Severity: Minor
Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.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 test_16_xml_import has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def test_16_xml_import(self):
        # file B2B downloaded from
        # http://www.fatturapa.gov.it/export/fatturazione/it/a-3.htm
        res = self.run_wizard('test16a', 'IT01234567890_FPR03.xml')
        invoice_ids = res.get('domain')[0][2]
Severity: Minor
Found in l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.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 create_fatturapa_attachment_in has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def create_fatturapa_attachment_in(self, attachment):
        decoded = base64.b64decode(attachment.datas)
        fatturapa_attachment_in = self.env['fatturapa.attachment.in']
        fetchmail_server_id = self.env.context.get('fetchmail_server_id')
        company_id = False
Severity: Minor
Found in l10n_it_fatturapa_pec/models/mail_thread.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 setDatiPagamento has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def setDatiPagamento(self, invoice, body):
        if invoice.payment_term and invoice.withholding_tax_line:
            DatiPagamento = DatiPagamentoType()
            if not invoice.payment_term.fatturapa_pt_id:
                raise UserError(
Severity: Minor
Found in l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.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 create_sepa has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def create_sepa(self):
        """Creates the SEPA Credit Transfer file. That's the important code!"""
        self.ensure_one()
        sepa_export = self[0]
        pain_flavor = self.payment_order_ids[0].mode.type.code
Severity: Minor
Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.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 invoiceCreate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def invoiceCreate(
        self, fatt, fatturapa_attachment, FatturaBody, partner_id
    ):
        partner_model = self.env['res.partner']
        invoice_model = self.env['account.invoice']
Severity: Minor
Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.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 _build_codes_dict has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _build_codes_dict(self, tax_code, res=None):
        # TODO context
        if res is None:
            res = {}
        tax_model = self.env['account.tax']
Severity: Minor
Found in l10n_it_account/models/account_tax.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 create_account_move has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def create_account_move(self, cr, uid, ids, context=None):
        period_obj = self.pool['account.period']
        account_move_obj = self.pool['account.move']
        account_move_line_obj = self.pool['account.move.line']

Severity: Minor
Found in l10n_it_withholding_tax_payment/models/withholding_tax.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 exportFatturaPA has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def exportFatturaPA(self):
        invoice_obj = self.env['account.invoice']
        invoices_by_partner = self.group_invoices_by_partner()
        attachments = self.env['fatturapa.attachment.out']
        for partner_id in invoices_by_partner:
Severity: Minor
Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.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 _BuildAutomaton has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def _BuildAutomaton ():
    # Remove this helper function from the namespace after it is invoked
    global _BuildAutomaton
    del _BuildAutomaton
    import pyxb.utils.fac as fac
Severity: Major
Found in l10n_it_fatturapa/bindings/binding.py - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

            if Delivery:
                delivery_id = self.getCarrirerPartner(Delivery)
                delivery_dict = {
                    'carrier_id': delivery_id,
                    'transport_vehicle': Delivery.MezzoTrasporto or '',
    Severity: Critical
    Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 2 hrs to fix

      Function setRelatedDocumentTypes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def setRelatedDocumentTypes(self, invoice, body):
              res = super(WizardExportFatturapa, self).setRelatedDocumentTypes(
                  invoice, body)
              if invoice.partner_id.fatturapa_sale_order_data or \
                      self.env.user.company_id.fatturapa_sale_order_data:
      Severity: Minor
      Found in l10n_it_fatturapa_out_sale/wizard/wizard_export_fatturapa.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 _export_xml_get_dtr has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _export_xml_get_dtr(self):
              # ----- 3 - DTR
              x_3_dtr = etree.Element(
                  etree.QName("DTR"))
              # -----     2.1 - Cessionario Committente DTR
      Severity: Minor
      Found in l10n_it_invoices_data_communication/models/communication.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 add_to_ddt has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_to_ddt(self):
              pickings = self.env['stock.picking'].browse(
                  self.env.context['active_ids'])
              for picking in pickings:
                  if picking.ddt_ids and \
      Severity: Minor
      Found in l10n_it_ddt/wizard/add_picking_to_ddt.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 _compute_totals_tax has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compute_totals_tax(self, tax_code_ids):
              res = []
              tax_obj = self.pool.get('account.tax')
              tax_code_obj = self.pool.get('account.tax.code')
              tax_codes = tax_code_obj.browse(self.cr, self.uid, tax_code_ids)
      Severity: Minor
      Found in l10n_it_vat_registries/vat_registry.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 action_move_create has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def action_move_create(self):
              '''
              Split amount withholding tax on account move lines
              '''
              dp_obj = self.env['decimal.precision']
      Severity: Minor
      Found in l10n_it_withholding_tax/models/account.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 generate_party_agent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def generate_party_agent(self, parent_node, party_type, party_type_label,
                                   order, party_name, iban, bic, eval_ctx, gen_args,
                                   context=None):
      
              # CBI logic modified for add ABI of debitor
      Severity: Minor
      Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.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 _export_xml_get_dtr has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _export_xml_get_dtr(self):
              # ----- 3 - DTR
              x_3_dtr = etree.Element(
                  etree.QName("DTR"))
              # -----     2.1 - Cessionario Committente DTR
      Severity: Major
      Found in l10n_it_invoices_data_communication/models/communication.py - About 2 hrs to fix
        Severity
        Category
        Status
        Source
        Language