OCA/l10n-italy

View on GitHub

Showing 341 of 1,161 total issues

Function setDettaglioLinee has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def setDettaglioLinee(self, invoice, body):

        body.DatiBeniServizi = DatiBeniServiziType()
        # TipoCessionePrestazione not handled

Severity: Minor
Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py - About 7 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_35 has 174 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    File fyc.py has 436 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    ##############################################################################
    #
    #    OpenERP, Open Source Management Solution
    #    Copyright (C) 2010 Pexego Sistemas Informáticos. All Rights Reserved
    Severity: Minor
    Found in account_fiscal_year_closing/fyc.py - About 6 hrs to fix

      File test_fatturapa_xml_validation.py has 436 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      # Copyright 2014 Davide Corio
      # Copyright 2015-2016 Lorenzo Battistini - Agile Business Group
      # Copyright 2018-2019 Alex Comba - Agile Business Group
      # Copyright 2019 Sergio Corato
      Severity: Minor
      Found in l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py - About 6 hrs to fix

        Function _BuildAutomaton_6 has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function getPartnerBase has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              def getPartnerBase(self, DatiAnagrafici, supplier=True):
                  if not DatiAnagrafici:
                      return False
                  partner_model = self.env['res.partner']
                  cf = DatiAnagrafici.CodiceFiscale or False
          Severity: Minor
          Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 5 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 _createPaymentsLine has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              def _createPaymentsLine(self, payment_id, line, partner_id):
                  details = line.DettaglioPagamento or False
                  if details:
                      PaymentModel = self.env['fatturapa.payment.detail']
                      PaymentMethodModel = self.env['fatturapa.payment_method']
          Severity: Minor
          Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 5 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_5 has 147 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function getCedPrest has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

                def getCedPrest(self, cedPrest):
                    partner_model = self.env['res.partner']
                    partner_id = self.getPartnerBase(cedPrest.DatiAnagrafici)
                    no_contact_update = False
                    if partner_id:
            Severity: Minor
            Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 5 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 _check_national_codes has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

                def _check_national_codes(
                        self, birth_city, birth_prov, birth_date, cities):
                    nc = ''
                    dtcostvar = None
                    for ct in cities:
            Severity: Minor
            Found in l10n_it_fiscalcode/wizard/compute_fc.py - About 5 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

            WizardImportFatturapa has 42 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class WizardImportFatturapa(models.TransientModel):
                _name = "wizard.import.fatturapa"
                _description = "Import E-bill"
            
                e_invoice_detail_level = fields.Selection([
            Severity: Minor
            Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 5 hrs to fix

              File account.py has 400 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              # Copyright 2014 Davide Corio <davide.corio@abstract.it>
              # Copyright 2018 Gianmarco Conte, Marco Calcagni - Dinamiche Aziendali srl
              # Copyright 2019 Sergio Corato
              # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
              Severity: Minor
              Found in l10n_it_fatturapa/models/account.py - About 5 hrs to fix

                Function create_invoice has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                    def create_invoice(self):
                        ddt_model = self.env['stock.picking.package.preparation']
                        picking_pool = self.pool['stock.picking']
                
                        ddts = ddt_model.search(
                Severity: Minor
                Found in l10n_it_ddt/wizard/ddt_create_invoice.py - About 5 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 setRelatedDocumentTypes has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                    def setRelatedDocumentTypes(self, invoice, body):
                        for line in invoice.invoice_line:
                            for related_document in line.related_documents:
                                doc_type = RELATED_DOCUMENT_TYPES[related_document.type]
                                documento = DatiDocumentiCorrelatiType()
                Severity: Minor
                Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py - About 5 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 act_getfile has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                Open

                    def act_getfile(self, cr, uid, ids, context=None):
                        active_ids = context and context.get('active_ids', [])
                        order_obj = self.pool['riba.distinta'].browse(
                            cr, uid, active_ids, context=context)[0]
                        credit_bank = order_obj.config_id.bank_id
                Severity: Minor
                Found in l10n_it_ricevute_bancarie/wizard/wizard_riba_file_export.py - About 5 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

                TestFatturaPAXMLValidation has 40 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class TestFatturaPAXMLValidation(FatturapaCommon):
                
                    def setUp(self):
                        super(TestFatturaPAXMLValidation, self).setUp()
                        self.wt = self.create_wt_4q()
                Severity: Minor
                Found in l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py - About 5 hrs to fix

                  ComunicazioneDatiIva has 40 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ComunicazioneDatiIva(models.Model):
                      _name = 'comunicazione.dati.iva'
                      _description = 'Invoices data communication'
                      _rec_name = 'identificativo'
                  
                  
                  Severity: Minor
                  Found in l10n_it_invoices_data_communication/models/communication.py - About 5 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if details:
                                PaymentModel = self.env['fatturapa.payment.detail']
                                PaymentMethodModel = self.env['fatturapa.payment_method']
                                BankModel = self.env['res.bank']
                                PartnerBankModel = self.env['res.partner.bank']
                    Severity: Critical
                    Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 5 hrs to fix

                      WizardExportFatturapa has 40 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class WizardExportFatturapa(models.TransientModel):
                          _name = "wizard.export.fatturapa"
                          _description = "Export E-invoice"
                      
                          @api.model
                      Severity: Minor
                      Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py - About 5 hrs to fix

                        Consider simplifying this complex logical expression.
                        Open

                                if company_id:
                                    company = self.pool.get('res.company').browse(
                                        cr, uid, company_id, context=context)
                                    default_sequence = self.pool.get('ir.sequence').search(cr, uid, [
                                        ('code', '=', 'account.invoice.fatturapa')
                        Severity: Critical
                        Found in l10n_it_fatturapa/models/company.py - About 5 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language