OCA/l10n-italy

View on GitHub

Showing 1,161 of 1,161 total issues

Function _get_tax_lines has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_tax_lines(self, move):
        res = []
        # index è usato per non ripetere la stampa dei dati fattura quando ci
        # sono più codici IVA
        index = 0
Severity: Minor
Found in l10n_it_vat_registries/vat_registry.py - About 1 hr 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 _get_statement_from_line has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_statement_from_line(self, cr, uid, ids, context=None):
        move = {}
        for line in self.pool.get('account.move.line').browse(
            cr, uid, ids, context=context
        ):
Severity: Minor
Found in account_vat_period_end_statement/models/account.py - About 1 hr 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

        'previous_credit_vat_amount': fields.float(
            'Previous Credits VAT Amount',
            states={
                'confirmed': [('readonly', True)],
                'paid': [('readonly', True)],
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 1 other location - About 1 hr to fix
account_vat_period_end_statement/models/account.py on lines 291..298

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

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

        'previous_debit_vat_amount': fields.float(
            'Previous Debits VAT Amount',
            states={
                'confirmed': [('readonly', True)],
                'paid': [('readonly', True)],
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 1 other location - About 1 hr to fix
account_vat_period_end_statement/models/account.py on lines 274..281

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

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

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

    Function test_10_withholding_tax has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def test_10_withholding_tax(self):
            domain = [('name', '=', 'Provision')]
            wts = self.env['withholding.tax'].search(domain)
            self.assertEqual(len(wts), 1, msg="Withholding tax was not created")
    
    
    Severity: Minor
    Found in l10n_it_withholding_tax/tests/test_invoice_multi_line_tax.py - About 1 hr to fix

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

          company_id = fields.Many2one(
              'res.company', 'Company', required=True, readonly=True,
              states={'draft': [('readonly', False)]},
              default=lambda self: self.env['res.company']._company_default_get(
      Severity: Major
      Found in l10n_it_ricevute_bancarie/models/riba.py and 1 other location - About 1 hr to fix
      l10n_it_ricevute_bancarie/models/riba.py on lines 58..61

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

      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

          name = fields.Char(
              'Reference', required=True, readonly=True,
              states={'draft': [('readonly', False)]},
              default=(lambda self: self.env['ir.sequence'].get('riba.distinta')))
      Severity: Major
      Found in l10n_it_ricevute_bancarie/models/riba.py and 1 other location - About 1 hr to fix
      l10n_it_ricevute_bancarie/models/riba.py on lines 88..91

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

      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

          def _get_fatture_ricevute_domain(self):
              domain = super(Communication, self)._get_fatture_ricevute_domain()
              if self.exclude_e_invoices:
                  domain.append(('fatturapa_attachment_in_id', '=', False))
              return domain
      l10n_it_invoices_data_communication_fatturapa/models/communication.py on lines 10..14

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

      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

          def _get_fatture_emesse_domain(self):
              domain = super(Communication, self)._get_fatture_emesse_domain()
              if self.exclude_e_invoices:
                  domain.append(('fatturapa_attachment_out_id', '=', False))
              return domain
      l10n_it_invoices_data_communication_fatturapa/models/communication.py on lines 16..20

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

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

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

        Function _BuildAutomaton_7 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function _BuildAutomaton_33 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function _BuildAutomaton_26 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function message_route has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def message_route(self, message, message_dict, model=None, thread_id=None,
                                    custom_values=None):
                      if any("@pec.fatturapa.it" in x for x in [
                          message.get('Reply-To', ''),
                          message.get('From', ''),
              Severity: Minor
              Found in l10n_it_fatturapa_pec/models/mail_thread.py - About 1 hr 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 _normalizza_dati_partner has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _normalizza_dati_partner(self, partner, vals):
                      # Paesi Esteri :
                      # - Rimuovo CAP/provincia che potrebbero dare problemi nella
                      #   validazione
                      # Paesi UE :
              Severity: Minor
              Found in l10n_it_invoices_data_communication/models/communication.py - About 1 hr 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_partner_id has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def onchange_partner_id(
              Severity: Major
              Found in l10n_it_ddt/models/account.py - About 1 hr to fix

                Function set_withholding_tax has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def set_withholding_tax(self, FatturaBody, invoice_data):
                        Withholdings = FatturaBody.DatiGenerali. \
                            DatiGeneraliDocumento.DatiRitenuta
                        if not Withholdings:
                            return None
                Severity: Minor
                Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 1 hr 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 _setStabileOrganizzazione has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _setStabileOrganizzazione(self, CedentePrestatore, company):
                        if company.fatturapa_stabile_organizzazione:
                            stabile_organizzazione = company.fatturapa_stabile_organizzazione
                            if not stabile_organizzazione.street:
                                raise UserError(
                Severity: Minor
                Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py - About 1 hr 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_balance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _compute_balance(self, cr, uid, ids, name, args, context=None):
                        """
                        Extends the compute of original amounts for exclude from total the WT
                        amount
                        """
                Severity: Minor
                Found in l10n_it_withholding_tax/models/voucher.py - About 1 hr 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