OCA/l10n-italy

View on GitHub

Showing 1,161 of 1,161 total issues

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

    @api.depends('dati_fattura_iva_ids.ImponibileImporto',
                 'dati_fattura_iva_ids.Imposta')
    def _compute_total(self):
        for ft in self:
            totale_imponibile = 0
Severity: Major
Found in l10n_it_invoices_data_communication/models/communication.py and 3 other locations - About 3 hrs to fix
l10n_it_invoices_data_communication/models/communication.py on lines 2224..2234
l10n_it_invoices_data_communication/models/communication.py on lines 2268..2278
l10n_it_invoices_data_communication/models/communication.py on lines 2422..2432

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

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

    @api.depends('fatture_emesse_body_ids.totale_imponibile',
                 'fatture_emesse_body_ids.totale_iva')
    def _compute_total(self):
        for line in self:
            totale_imponibile = 0
Severity: Major
Found in l10n_it_invoices_data_communication/models/communication.py and 3 other locations - About 3 hrs to fix
l10n_it_invoices_data_communication/models/communication.py on lines 2268..2278
l10n_it_invoices_data_communication/models/communication.py on lines 2422..2432
l10n_it_invoices_data_communication/models/communication.py on lines 2467..2477

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

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

File account_invoice.py has 321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Copyright 2017 Davide Corio
# Copyright 2017 Alex Comba - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Severity: Minor
Found in l10n_it_reverse_charge/models/account_invoice.py - About 3 hrs to fix

    File withholding_tax.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # Copyright © 2015 Alessandro Camilli (<http://www.openforce.it>)
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
    
    
    
    Severity: Minor
    Found in l10n_it_withholding_tax/models/withholding_tax.py - About 3 hrs to fix

      Function _BuildAutomaton_18 has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function _BuildAutomaton_12 has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

                      if any([invoices_partner.cedente_rf_IdFiscaleIVA_IdPaese,
                              invoices_partner.cedente_rf_IdFiscaleIVA_IdCodice,
                              invoices_partner.cedente_rf_Denominazione,
                              invoices_partner.cedente_rf_Nome,
                              invoices_partner.cedente_rf_Cognome,
          Severity: Major
          Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 3 hrs to fix
          l10n_it_invoices_data_communication/models/communication.py on lines 941..954

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

          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.type in ('out_invoice','in_invoice'):
                                          inv_tax['tax_amount'] = cur_obj.compute(cr, uid, invoice.currency_id.id, company_currency,
                                              inv_tax['amount'] * main_tax['tax_sign'],
                                              context={'date': invoice.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
          Severity: Major
          Found in l10n_it_partially_deductible_vat/account.py and 1 other location - About 3 hrs to fix
          l10n_it_partially_deductible_vat/account.py on lines 205..212

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

          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

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

                  for period in fyc.closing_fiscalyear_id.period_ids:
                      if period.id != fyc.lp_period_id.id \
                              and period.id != fyc.nlp_period_id.id \
                              and period.id != fyc.c_period_id.id:
                          period_ids.append(period.id)
          Severity: Major
          Found in account_fiscal_year_closing/wizard/wizard_run.py and 1 other location - About 3 hrs to fix
          account_fiscal_year_closing/wizard/wizard_run.py on lines 192..196

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

          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

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

                  for period in fyc.closing_fiscalyear_id.period_ids:
                      if period.id != fyc.lp_period_id.id \
                              and period.id != fyc.nlp_period_id.id \
                              and period.id != fyc.c_period_id.id:
                          period_ids.append(period.id)
          Severity: Major
          Found in account_fiscal_year_closing/wizard/wizard_run.py and 1 other location - About 3 hrs to fix
          account_fiscal_year_closing/wizard/wizard_run.py on lines 223..227

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

          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 any([invoices_partner.cessionario_rf_IdFiscaleIVA_IdPaese,
                              invoices_partner.cessionario_rf_IdFiscaleIVA_IdCodice,
                              invoices_partner.cessionario_rf_Denominazione,
                              invoices_partner.cessionario_rf_Nome,
                              invoices_partner.cessionario_rf_Cognome,
          Severity: Major
          Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 3 hrs to fix
          l10n_it_invoices_data_communication/models/communication.py on lines 1150..1162

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

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

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

            Function check_tax has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def check_tax(self, cr, uid, tax, context=None):
                    """
                    This is used to check that every (purchase) tax code is linked to
                    only one (main) tax.
                    This allows to print a VAT register summary where
            Severity: Minor
            Found in l10n_it_account/models/account_tax.py - About 3 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 onchange_company_id has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def onchange_company_id(self, cr, uid, ids, company_id, context=None):
                    res = super(AccountConfigSettings, self).onchange_company_id(
                        cr, uid, ids, company_id, context=context)
                    if company_id:
                        company = self.pool.get('res.company').browse(
            Severity: Minor
            Found in l10n_it_fatturapa/models/company.py - About 3 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_move has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def create_move(self, cr, uid, ids, context=None):
                    if context is None:
                        context = {}
                    # wf_service = netsvc.LocalService("workflow")
                    active_id = context and context.get('active_id', False) or False
            Severity: Minor
            Found in l10n_it_ricevute_bancarie/wizard/wizard_unsolved.py - About 3 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

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

                            if invoice.partner_bank_id:
                                DettaglioPagamento.IstitutoFinanziario = (
                                    invoice.partner_bank_id.bank_name)
                                if invoice.partner_bank_id.acc_number:
                                    DettaglioPagamento.IBAN = (
            Severity: Major
            Found in l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py and 1 other location - About 3 hrs to fix
            l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py on lines 807..816

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

            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

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

                            if invoice.partner_bank_id:
                                DettaglioPagamento.IstitutoFinanziario = (
                                    invoice.partner_bank_id.bank_name)
                                if invoice.partner_bank_id.acc_number:
                                    DettaglioPagamento.IBAN = (
            Severity: Major
            Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py and 1 other location - About 3 hrs to fix
            l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py on lines 150..159

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

            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

                def _get_credit_line(self, cr, uid, ids, context=None):
                    result = {}
                    for line in self.pool.get('statement.credit.account.line').browse(
                        cr, uid, ids, context=context
                    ):
            Severity: Major
            Found in account_vat_period_end_statement/models/account.py and 2 other locations - About 3 hrs to fix
            account_vat_period_end_statement/models/account.py on lines 185..191
            account_vat_period_end_statement/models/account.py on lines 193..199

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

            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

                def _get_debit_line(self, cr, uid, ids, context=None):
                    result = {}
                    for line in self.pool.get('statement.debit.account.line').browse(
                        cr, uid, ids, context=context
                    ):
            Severity: Major
            Found in account_vat_period_end_statement/models/account.py and 2 other locations - About 3 hrs to fix
            account_vat_period_end_statement/models/account.py on lines 177..183
            account_vat_period_end_statement/models/account.py on lines 193..199

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

            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

                def _get_generic_line(self, cr, uid, ids, context=None):
                    result = {}
                    for line in self.pool.get('statement.generic.account.line').browse(
                        cr, uid, ids, context=context
                    ):
            Severity: Major
            Found in account_vat_period_end_statement/models/account.py and 2 other locations - About 3 hrs to fix
            account_vat_period_end_statement/models/account.py on lines 177..183
            account_vat_period_end_statement/models/account.py on lines 185..191

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

            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