OCA/l10n-italy

View on GitHub

Showing 1,161 of 1,161 total issues

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

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

        if (
            DatiAnagrafici.Anagrafica.Cognome and
            partner.lastname != DatiAnagrafici.Anagrafica.Cognome
        ):
            self.log_inconsistency(
Severity: Major
Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py and 2 other locations - About 2 hrs to fix
l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 88..95
l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 96..103

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

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 3 locations. Consider refactoring.
Open

        if (
            DatiAnagrafici.Anagrafica.Nome and
            partner.firstname != DatiAnagrafici.Anagrafica.Nome
        ):
            self.log_inconsistency(_(
Severity: Major
Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py and 2 other locations - About 2 hrs to fix
l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 88..95
l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 104..113

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

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 3 locations. Consider refactoring.
Open

        if (
            DatiAnagrafici.Anagrafica.Denominazione and
            partner.name != DatiAnagrafici.Anagrafica.Denominazione
        ):
            self.log_inconsistency(_(
Severity: Major
Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py and 2 other locations - About 2 hrs to fix
l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 96..103
l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 104..113

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

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 _export_xml_get_dte has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _export_xml_get_dte(self):
        # ----- 2 - DTE
        x_2_dte = etree.Element(
            etree.QName("DTE"))
        # -----     2.1 - Cedente Prestatore DTE
Severity: Major
Found in l10n_it_invoices_data_communication/models/communication.py - About 2 hrs to fix

    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

      Function _BuildAutomaton_2 has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function _BuildAutomaton_ has 55 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

          Function _BuildAutomaton_34 has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function _BuildAutomaton_15 has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

                          if invoice.reference == '123':
                              self.assertTrue(len(invoice.invoice_line) == 2)
                              for line in invoice.invoice_line:
                                  self.assertFalse(line.product_id)
              Severity: Major
              Found in l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py and 1 other location - About 2 hrs to fix
              l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py on lines 311..314

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

              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 invoice.reference == '456':
                              self.assertTrue(len(invoice.invoice_line) == 1)
                              for line in invoice.invoice_line:
                                  self.assertFalse(line.product_id)
              Severity: Major
              Found in l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py and 1 other location - About 2 hrs to fix
              l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py on lines 307..310

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

              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 invoices_partner.cessionario_sede_Cap and \
                                  not re.match(
                                      '[0-9]{5}', invoices_partner.cessionario_sede_Cap):
                              errors.append(_(
                                  u'ZIP %s of assignee %s is not 5 numeric characters'
              Severity: Major
              Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 2 hrs to fix
              l10n_it_invoices_data_communication/models/communication.py on lines 1164..1171

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

              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 invoices_partner.cedente_sede_Cap and \
                                  not re.match(
                                      '[0-9]{5}', invoices_partner.cedente_sede_Cap):
                              errors.append(_(
                                  u'ZIP %s of seller %s is not 5 characters'
              Severity: Major
              Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 2 hrs to fix
              l10n_it_invoices_data_communication/models/communication.py on lines 956..963

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

              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 setUp has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def setUp(self):
                      super(FatturaPACommon, self).setUp()
                      self.seq_model = self.env['ir.sequence']
                      self.res_user_model = self.env['res.users']
                      self.company = self.env.ref('base.main_company')
              Severity: Major
              Found in l10n_it_fatturapa_out/tests/fatturapa_common.py - About 2 hrs to fix

                Function get_account_taxes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_account_taxes(self, AliquotaIVA, Natura):
                        account_tax_model = self.env['account.tax']
                        # check if a default tax exists and generate def_purchase_tax object
                        ir_values = self.env['ir.values']
                        company_id = self.env['res.company']._company_default_get(
                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

                Severity
                Category
                Status
                Source
                Language