OCA/l10n-italy

View on GitHub
l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py

Summary

Maintainability
F
3 days
Test Coverage

Function create_sepa has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def create_sepa(self):
        """Creates the SEPA Credit Transfer file. That's the important code!"""
        self.ensure_one()
        sepa_export = self[0]
        pain_flavor = self.payment_order_ids[0].mode.type.code
Severity: Minor
Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.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 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def generate_party_agent(
Severity: Major
Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py - About 1 hr to fix

    Function generate_creditor_scheme_identification has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def generate_creditor_scheme_identification(
    Severity: Minor
    Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py - About 45 mins to fix

      Function generate_party_agent has a Cognitive Complexity of 8 (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
              # ABI code from IBAN
      Severity: Minor
      Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py - About 45 mins 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

              for payment_order in self.payment_order_ids:
                  total_amount = total_amount + payment_order.total
                  for line in payment_order.bank_line_ids:
                      priority = line.priority
                      # The field line.date is the requested payment date
      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 212..224

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

      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

              if pain_flavor in pain_03_to_05:
                  nb_of_transactions_1_6.text = str(transactions_count_1_6)
                  control_sum_1_7.text = '%.2f' % amount_control_sum_1_7
              else:
                  nb_of_transactions_1_6.text = str(transactions_count_1_6)
      Severity: Major
      Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py and 1 other location - About 2 hrs to fix
      l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py on lines 343..348

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

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

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

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

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

      Refactorings

      Further Reading

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

          @api.model
          def create(self, vals):
              payment_order_ids = self._context.get('active_ids', [])
              vals.update({
                  'payment_order_ids': [[6, 0, payment_order_ids]],
      Severity: Major
      Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py and 1 other location - About 2 hrs to fix
      l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py on lines 71..77

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

      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 pain_flavor == 'CBIBdyPaymentRequest.00.04.00':
                  bic_xml_tag = 'BIC'
                  name_maxsize = 70
                  root_xml_tag = 'CBIEnvelPaymentRequest'
                  xsd_ref = 'CBIPaymentRequest.00.04.00'
      Severity: Major
      Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py and 1 other location - About 1 hr to fix
      l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py on lines 165..172

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

      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 not abi_code and company_bank.state == 'iban':
                      iban = company_bank.acc_number.replace(" ", "")
                      abi_code = iban[5:10]
      Severity: Major
      Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py and 1 other location - About 1 hr to fix
      l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py on lines 96..98

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

      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 not line.bank_id:
                          raise UserError(
                              _("Missing Bank Account on invoice '%s' (payment "
                                "order line reference '%s')")
                              % (line.ml_inv_ref.number, line.name))
      Severity: Minor
      Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py and 1 other location - About 50 mins to fix
      l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py on lines 299..303

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

      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 pain_flavor in pain_03_to_05:
                      nb_of_transactions_2_4.text = str(transactions_count_2_4)
                      control_sum_2_5.text = '%.2f' % amount_control_sum_2_5
      Severity: Minor
      Found in l10n_it_sepa_bonifici/wizard/export_sepa_cbi.py and 1 other location - About 40 mins to fix
      l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py on lines 340..342

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

      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

      There are no issues that match your filters.

      Category
      Status