OCA/l10n-italy

View on GitHub

Showing 1,161 of 1,161 total issues

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

    @api.model
    def create(self, vals):
        if vals.get('invoice_line_id'):
            line_obj = self.env['account.invoice.line']
            line = line_obj.browse(vals['invoice_line_id'])
Severity: Major
Found in l10n_it_fatturapa/models/account.py and 2 other locations - About 4 hrs to fix
l10n_it_fatturapa/models/account.py on lines 214..220
l10n_it_fatturapa/models/account.py on lines 499..505

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

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

    @api.model
    def create(self, vals):
        if vals.get('invoice_line_id'):
            line_obj = self.env['account.invoice.line']
            line = line_obj.browse(vals['invoice_line_id'])
Severity: Major
Found in l10n_it_fatturapa/models/account.py and 2 other locations - About 4 hrs to fix
l10n_it_fatturapa/models/account.py on lines 214..220
l10n_it_fatturapa/models/account.py on lines 264..270

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

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

    @api.model
    def create(self, vals):
        if vals.get('invoice_line_id'):
            line_obj = self.env['account.invoice.line']
            line = line_obj.browse(vals['invoice_line_id'])
Severity: Major
Found in l10n_it_fatturapa/models/account.py and 2 other locations - About 4 hrs to fix
l10n_it_fatturapa/models/account.py on lines 264..270
l10n_it_fatturapa/models/account.py on lines 499..505

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

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 wizard_run.py has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP - Import operations model 347 engine
#    Copyright (C) 2009 Asr Oss. All Rights Reserved
Severity: Minor
Found in account_fiscal_year_closing/wizard/wizard_run.py - About 4 hrs to fix

    Function create_list has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_list(self):
            def create_rdl(countme, bank_id, rd_id, date_maturity, partner_id,
                           acceptance_account_id):
                rdl = {
                    'sequence': countme,
    Severity: Minor
    Found in l10n_it_ricevute_bancarie/wizard/wizard_riba_issue.py - About 4 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_self_invoice has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_self_invoice(self):
            rc_type = self.fiscal_position.rc_type_id
            if not rc_type.payment_journal_id.default_credit_account_id:
                raise UserError(
                    _('There is no default credit account defined \n'
    Severity: Minor
    Found in l10n_it_reverse_charge/models/account_invoice.py - About 4 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 vat:
                domain = [('vat', '=', vat)]
                if self.env.context.get('from_attachment'):
                    att = self.env.context.get('from_attachment')
                    domain.extend([
    Severity: Major
    Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py and 1 other location - About 4 hrs to fix
    l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 146..155

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

    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

            vals1 = {
                'partner_id': res1['context']['default_partner_id'],
                'amount': res1['context']['default_amount'],
                'reference': res1['context']['default_reference'],
                'type': res1['context']['default_type'],
    l10n_it_withholding_tax/tests/test_invoice_multi_line_tax.py on lines 155..161
    l10n_it_withholding_tax/tests/test_invoice_multi_line_tax.py on lines 205..211

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

    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

            vals = {
                'partner_id': res['context']['default_partner_id'],
                'amount': res['context']['default_amount'],
                'reference': res['context']['default_reference'],
                'type': res['context']['default_type'],
    l10n_it_withholding_tax/tests/test_invoice_multi_line_tax.py on lines 205..211
    l10n_it_withholding_tax/tests/test_invoice_multi_line_tax.py on lines 254..260

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

    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 not partners and cf:
                domain = [('fiscalcode', '=', cf)]
                if self.env.context.get('from_attachment'):
                    att = self.env.context.get('from_attachment')
                    domain.extend([
    Severity: Major
    Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py and 1 other location - About 4 hrs to fix
    l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 136..145

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

    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

            vals = {
                'partner_id': res['context']['default_partner_id'],
                'amount': res['context']['default_amount'],
                'reference': res['context']['default_reference'],
                'type': res['context']['default_type'],
    l10n_it_withholding_tax/tests/test_invoice_multi_line_tax.py on lines 155..161
    l10n_it_withholding_tax/tests/test_invoice_multi_line_tax.py on lines 254..260

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

    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_so_Indirizzo,
                        invoices_partner.cessionario_so_NumeroCivico,
                        invoices_partner.cessionario_so_Cap,
                        invoices_partner.cessionario_so_Comune,
                        invoices_partner.cessionario_so_Provincia,
    Severity: Major
    Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 4 hrs to fix
    l10n_it_invoices_data_communication/models/communication.py on lines 1134..1148

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

    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

        @api.multi
        def save_sepa(self):
            """Save the SEPA file: send the done signal to all payment
            orders in the file. With the default workflow, they will
            transition to 'done', while with the advanced workflow in
    Severity: Major
    Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py and 1 other location - About 4 hrs to fix
    l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py on lines 353..370

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

    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

        @api.multi
        def save_sepa(self):
            """Save the SEPA file: send the done signal to all payment
            orders in the file. With the default workflow, they will
            transition to 'done', while with the advanced workflow in
    Severity: Major
    Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py and 1 other location - About 4 hrs to fix
    l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py on lines 257..274

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

    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.cedente_so_Indirizzo,
                        invoices_partner.cedente_so_NumeroCivico,
                        invoices_partner.cedente_so_Cap,
                        invoices_partner.cedente_so_Comune,
                        invoices_partner.cedente_so_Provincia,
    Severity: Major
    Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 4 hrs to fix
    l10n_it_invoices_data_communication/models/communication.py on lines 924..939

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

    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 test_fatturapa_wt.py has 340 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from openerp.addons.l10n_it_fatturapa_out.tests.fatturapa_common import (
        FatturaPACommon)
    
    
    class TestInvoiceWT(FatturaPACommon):
    Severity: Minor
    Found in l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py - About 4 hrs to fix

      File account.py has 337 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/account.py - About 4 hrs to fix

        File riba.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        ##############################################################################
        #
        #    Copyright (C) 2012 Andrea Cometa.
        #    Email: info@andreacometa.it
        Severity: Minor
        Found in l10n_it_ricevute_bancarie/models/riba.py - About 4 hrs to fix

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

                  self.env['withholding.tax'].create({
                      'name': '1040/3',
                      'code': '1040',
                      'account_receivable_id': account_receivable.id,
                      'account_payable_id': account_payable.id,
          Severity: Major
          Found in l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py and 3 other locations - About 4 hrs to fix
          l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py on lines 703..716
          l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py on lines 719..732
          l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py on lines 751..764

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

          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 cedPrest.Sede.Provincia:
                          Provincia = cedPrest.Sede.Provincia
                          prov_sede = self.ProvinceByCode(Provincia)
                          if not prov_sede:
                              self.log_inconsistency(
          Severity: Major
          Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py and 1 other location - About 4 hrs to fix
          l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 225..235

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

          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