bmya/odoo-bmya-cl

View on GitHub

Showing 71 of 71 total issues

Function generic_connection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def generic_connection(self):
        _logger.warning('Entering function "test connection"')
        base_url = self.url
        
        # token en el ecabezado (por ejemplo toggl)
Severity: Minor
Found in webservices_generic/models/webservices_generic.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

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

    def _printed_prices(self, cr, uid, ids, name, args, context=None):
Severity: Minor
Found in l10n_cl_invoice/models/invoice.py - About 45 mins to fix

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

                    dte['Encabezado']['Totales']['IVA'] = int(round(inv.amount_tax, 0))
    Severity: Major
    Found in l10n_cl_dte/models/invoice.py and 3 other locations - About 40 mins to fix
    l10n_cl_dte/models/invoice.py on lines 567..569
    l10n_cl_dte/models/invoice.py on lines 571..572
    l10n_cl_dte/models/invoice.py on lines 576..577

    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

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

                dte['Encabezado']['Totales']['MntTotal'] = int(round(
                    inv.amount_total, 0))
    Severity: Major
    Found in l10n_cl_dte/models/invoice.py and 3 other locations - About 40 mins to fix
    l10n_cl_dte/models/invoice.py on lines 567..569
    l10n_cl_dte/models/invoice.py on lines 571..572
    l10n_cl_dte/models/invoice.py on lines 575..575

    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

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

                if inv.sii_document_class_id.sii_code == 34:
                    dte['Encabezado']['Totales']['MntExe'] = int(round(
                        inv.amount_total, 0))
    Severity: Major
    Found in l10n_cl_dte/models/invoice.py and 3 other locations - About 40 mins to fix
    l10n_cl_dte/models/invoice.py on lines 571..572
    l10n_cl_dte/models/invoice.py on lines 575..575
    l10n_cl_dte/models/invoice.py on lines 576..577

    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

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

                    dte['Encabezado']['Totales']['MntNeto'] = int(round(
                        inv.amount_untaxed, 0))
    Severity: Major
    Found in l10n_cl_dte/models/invoice.py and 3 other locations - About 40 mins to fix
    l10n_cl_dte/models/invoice.py on lines 567..569
    l10n_cl_dte/models/invoice.py on lines 575..575
    l10n_cl_dte/models/invoice.py on lines 576..577

    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

    Function download_document has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def download_document(self, model, field, id, filename=None, **kw):
    Severity: Minor
    Found in l10n_cl_dte/controllers/downloader.py - About 35 mins to fix

      Function get_salary has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def get_salary(self, emp_id, emp_salary, cod_id, mes, ano):
      Severity: Minor
      Found in l10n_cl_hr_payroll/report/report_hr_salary_book.py - About 35 mins to fix

        Function get_worked_days has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_worked_days(self, form, emp_id, emp_salary, mes, ano):
        Severity: Minor
        Found in l10n_cl_hr_payroll/report/report_hr_salary_book.py - About 35 mins to fix

          Function create_journals has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def create_journals(self, cr, uid, journal_ids, wz, context=None):
          Severity: Minor
          Found in l10n_cl_invoice/wizard/journal_config_wizard.py - About 35 mins to fix

            Function create_sequence has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def create_sequence(self, cr, uid, name, journal, context=None):
            Severity: Minor
            Found in l10n_cl_invoice/wizard/journal_config_wizard.py - About 35 mins to fix

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

                          (data_json[indicadores[self.name][1]][0]['Fecha'],
              l10n_cl_financial_indicators/models/l10n_cl_financial_indicators.py on lines 38..38
              l10n_cl_financial_indicators/models/l10n_cl_financial_indicators.py on lines 41..41

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

              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 send_dte has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def send_dte(self):
                      self.ensure_one()
              
                      _logger.info('Entering Send XML Function')
                      _logger.info(
              Severity: Minor
              Found in l10n_cl_dte/models/invoice.py - About 35 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

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

                           data_json[indicadores[self.name][1]][0]['Valor']))
              l10n_cl_financial_indicators/models/l10n_cl_financial_indicators.py on lines 37..37
              l10n_cl_financial_indicators/models/l10n_cl_financial_indicators.py on lines 41..41

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

              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

                          dte['Encabezado']['Emisor']['GiroEmis'] = inv.turn_issuer.name[:80]
              Severity: Minor
              Found in l10n_cl_dte/models/invoice.py and 1 other location - About 35 mins to fix
              l10n_cl_dte/models/invoice.py on lines 561..561

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

              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

                          dte['Encabezado']['Emisor']['RUTEmisor'] = self.format_vat(
                              inv.company_id.vat)
              Severity: Minor
              Found in l10n_cl_dte/models/invoice.py and 1 other location - About 35 mins to fix
              l10n_cl_dte/models/invoice.py on lines 558..559

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

              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

                          dte['Encabezado']['Receptor']['RUTRecep'] = self.format_vat(
                              inv.partner_id.vat)
              Severity: Minor
              Found in l10n_cl_dte/models/invoice.py and 1 other location - About 35 mins to fix
              l10n_cl_dte/models/invoice.py on lines 542..543

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

              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

                          dte['Encabezado']['Receptor']['GiroRecep'] = inv.invoice_turn.name[:40]
              Severity: Minor
              Found in l10n_cl_dte/models/invoice.py and 1 other location - About 35 mins to fix
              l10n_cl_dte/models/invoice.py on lines 545..545

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

              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

                          data_json[indicadores[self.name][1]][0]['Valor'].replace(
              l10n_cl_financial_indicators/models/l10n_cl_financial_indicators.py on lines 37..37
              l10n_cl_financial_indicators/models/l10n_cl_financial_indicators.py on lines 38..38

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

              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

              class ResCountryState(models.Model):
                  _inherit='res.country.state'
              
                  sii_regional_office_ids = fields.Many2many(
              Severity: Minor
              Found in l10n_cl_dte/models/sii_regional_offices.py and 1 other location - About 30 mins to fix
              l10n_cl_invoice/models/account.py on lines 212..214

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

              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