OCA/l10n-italy

View on GitHub

Showing 1,161 of 1,161 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def move_payment_confirmed(self, cr, uid, ids, *args):
        wt_move_obj = self.pool['withholding.tax.move']
        for move in self.browse(cr, uid, ids):
            if move.state in ['draft']:
                self.write(cr, uid, [move.id], {'state': 'confirmed'})
Severity: Major
Found in l10n_it_withholding_tax_payment/models/withholding_tax.py and 1 other location - About 5 hrs to fix
l10n_it_withholding_tax_payment/models/withholding_tax.py on lines 198..208

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if partner_invoice.cedente_IdFiscaleIVA_IdPaese and \
                    partner_invoice.cedente_IdFiscaleIVA_IdCodice:
                # -----             2.2.1.1 - Id Fiscale IVA
                x_3_2_1_1_id_fiscale_iva = etree.SubElement(
                    x_3_2_1_identificativi_fiscali,
Severity: Major
Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 5 hrs to fix
l10n_it_invoices_data_communication/models/communication.py on lines 1424..1441

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            if partner_invoice.cessionario_IdFiscaleIVA_IdPaese and \
                    partner_invoice.cessionario_IdFiscaleIVA_IdCodice:
                # -----             2.2.1.1 - Id Fiscale IVA
                x_2_2_1_1_id_fiscale_iva = etree.SubElement(
                    x_2_2_1_identificativi_fiscali,
Severity: Major
Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 5 hrs to fix
l10n_it_invoices_data_communication/models/communication.py on lines 1835..1852

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 95.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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 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 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      class fiscal_year_closing_lp_account_mapping(osv.osv):
          """
          Loss & Profit Account Mapping
          """
      
      
      Severity: Major
      Found in account_fiscal_year_closing/fyc.py and 1 other location - About 5 hrs to fix
      account_fiscal_year_closing/fyc.py on lines 78..94

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 92.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      class fiscal_year_closing_nlp_account_mapping(osv.osv):
          """
          Net Loss & Profit Account Mapping
          """
      
      
      Severity: Major
      Found in account_fiscal_year_closing/fyc.py and 1 other location - About 5 hrs to fix
      account_fiscal_year_closing/fyc.py on lines 57..73

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 92.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      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

        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 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

              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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        if len(account_move_ids):
                            invalid_period_moves = pool.get('account.move').browse(cr, uid, account_move_ids, context)
                            str_invalid_period_moves = '\n'.join(['id: %s, date: %s, number: %s, ref: %s' % (move.id, move.date, move.name, move.ref) for move in invalid_period_moves])
                            raise osv.except_osv(_('Error'), _('One or more moves with invalid period or date found on the fiscal year: \n%s') % str_invalid_period_moves)
                Severity: Major
                Found in account_fiscal_year_closing/wizard/wizard_run.py and 1 other location - About 5 hrs to fix
                account_fiscal_year_closing/wizard/wizard_run.py on lines 207..210

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 90.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        if len(account_move_ids):
                            draft_moves = pool.get('account.move').browse(cr, uid, account_move_ids, context)
                            str_draft_moves = '\n'.join(['id: %s, date: %s, number: %s, ref: %s' % (move.id, move.date, move.name, move.ref) for move in draft_moves])
                            raise osv.except_osv(_('Error'), _('One or more draft moves found: \n%s') % str_draft_moves)
                Severity: Major
                Found in account_fiscal_year_closing/wizard/wizard_run.py and 1 other location - About 5 hrs to fix
                account_fiscal_year_closing/wizard/wizard_run.py on lines 175..178

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 90.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    @api.constrains('fetch_pec_server_id')
                    def check_fetch_pec_server_id(self):
                        for channel in self:
                            domain = [
                                ('fetch_pec_server_id', '=', channel.fetch_pec_server_id.id)]
                Severity: Major
                Found in l10n_it_sdi_channel/models/sdi.py and 1 other location - About 5 hrs to fix
                l10n_it_sdi_channel/models/sdi.py on lines 63..71

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 88.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language