OCA/openupgradelib

View on GitHub

Showing 120 of 163 total issues

Function _change_reference_refs_orm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _change_reference_refs_orm(
    env, model_name, record_ids, target_record_id, exclude_columns
):
    fields = env["ir.model.fields"].search([("ttype", "=", "reference")])
    if version_info[0] >= 12:
Severity: Minor
Found in openupgradelib/openupgrade_merge_records.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 delete_model_workflow has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def delete_model_workflow(cr, model, drop_indexes=False):
    """
    Forcefully remove active workflows for obsolete models,
    to prevent foreign key issues when the orm deletes the model.

Severity: Minor
Found in openupgradelib/openupgrade.py - About 55 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 rename_columns has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def rename_columns(cr, column_spec):
    """
    Rename table columns. Typically called in the pre script.

    :param column_spec: a hash with table keys, with lists of tuples as \
Severity: Minor
Found in openupgradelib/openupgrade.py - About 55 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 _displayItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const _displayItem = (item, searchTerms, highlightTerms) => {
  const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
  const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
  const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
  const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
Severity: Minor
Found in docs/_static/searchtools.js - About 55 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 update_aliases has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def update_aliases(
    cr,
    registry,
    model_name,
    set_parent_thread_id,
Severity: Minor
Found in openupgradelib/openupgrade_80.py - About 55 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 convert_html_fragment has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def convert_html_fragment(html_string, replacements, pretty_print=True):
    """Get a string that contains XML and apply replacements to it.

    :param str xml_string:
        XML string object.
Severity: Minor
Found in openupgradelib/openupgrade_tools.py - About 55 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 logged_query has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def logged_query(cr, query, args=None, skip_no_result=False):
    """
    Logs query and affected rows at level DEBUG.

    :param query: a query string suitable to pass to cursor.execute()
Severity: Minor
Found in openupgradelib/openupgrade.py - About 55 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 cow_templates_mark_if_equal_to_upstream has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def cow_templates_mark_if_equal_to_upstream(cr, mark_colname=None):
    """Record which COW'd templates are equal to their upstream equivalents.

    This is meant to be executed in a pre-migration script.

Severity: Minor
Found in openupgradelib/openupgrade.py - About 55 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 copy_columns has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def copy_columns(cr, column_spec):
    """
    Copy table columns. Typically called in the pre script.

    :param column_spec: a hash with table keys, with lists of tuples as
Severity: Minor
Found in openupgradelib/openupgrade.py - About 55 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 rename_fields has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def rename_fields(env, field_spec, no_deep=False):
    """Rename fields. Typically called in the pre script. WARNING: If using
    this on base module, pass the argument ``no_deep`` with True value for
    avoiding the using of the environment (which is not yet loaded).

Severity: Minor
Found in openupgradelib/openupgrade.py - About 55 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 map_values has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def map_values(
Severity: Major
Found in openupgradelib/openupgrade.py - About 50 mins to fix

    Function fill_analytic_distribution has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def fill_analytic_distribution(
    Severity: Major
    Found in openupgradelib/openupgrade_160.py - About 50 mins to fix

      Function _change_generic has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _change_generic(
      Severity: Major
      Found in openupgradelib/openupgrade_merge_records.py - About 50 mins to fix

        Function message has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def message(cr, module, table, column, message, *args, **kwargs):
        Severity: Major
        Found in openupgradelib/openupgrade.py - About 50 mins to fix

          Function _change_foreign_key_refs has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _change_foreign_key_refs(
          Severity: Major
          Found in openupgradelib/openupgrade_merge_records.py - About 50 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if api and isinstance(pool, api.Environment):
                                    value = obj.default_get([field]).get(field)
                                else:
                                    value = obj.default_get(cr, SUPERUSER_ID, [field]).get(field)
                                if value:
            Severity: Major
            Found in openupgradelib/openupgrade.py - About 45 mins to fix

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

              def set_partner_id_from_partner_address_id(
              Severity: Minor
              Found in openupgradelib/openupgrade_70.py - About 45 mins to fix

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

                def add_xmlid(cr, module, xmlid, model, res_id, noupdate=False):
                Severity: Minor
                Found in openupgradelib/openupgrade.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if value:
                                          write_value(ids, field, value)
                                  else:
                  Severity: Major
                  Found in openupgradelib/openupgrade.py - About 45 mins to fix

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

                    def _change_many2many_refs_orm(
                        env, model_name, record_ids, target_record_id, exclude_columns
                    ):
                        fields = env["ir.model.fields"].search(
                            [
                    Severity: Minor
                    Found in openupgradelib/openupgrade_merge_records.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

                    Severity
                    Category
                    Status
                    Source
                    Language