OCA/openupgradelib

View on GitHub

Showing 120 of 163 total issues

Avoid deeply nested control flow statements.
Open

                    if data and data != "None":
                        attachment_model.create(
                            {
                                "name": field,
                                "res_model": model_name,
Severity: Major
Found in openupgradelib/openupgrade_90.py - About 45 mins to fix

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

    def invalidate_cache(env, flush=True):
        """Version-independent cache invalidation.
    
        :param flush: whether pending updates should be flushed before invalidation.
            It is ``True`` by default, which ensures cache consistency.
    Severity: Minor
    Found in openupgradelib/openupgrade_tools.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 _change_many2one_refs_orm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _change_many2one_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

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

    def _change_translations_orm(
        env, model_name, record_ids, target_record_id, exclude_columns
    ):
        if version_info[0] > 15:
            return
    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

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

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

      Avoid deeply nested control flow statements.
      Open

                          if field_type == "serialized":
                              import json
      
                              vals[column] = json.dumps(field_val)
                          elif field_type == "jsonb":
      Severity: Major
      Found in openupgradelib/openupgrade_merge_records.py - About 45 mins to fix

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

          initEscapeListener: () => {
            // only install a listener if it is really needed
            if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return;
        
            document.addEventListener("keydown", (event) => {
        Severity: Minor
        Found in docs/_static/sphinx_highlight.js - 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 convert_field_to_html has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

          def safe_unlink(records, do_raise=False):
              """Allow for errors to occur during unlinking of records.
          
              Prevent broken database transactions, and by default, catch exceptions.
          
          
          Severity: Minor
          Found in openupgradelib/openupgrade.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

          Avoid deeply nested control flow statements.
          Open

                              if field in obj._defaults:
                                  if not callable(obj._defaults[field]):
                                      write_value(ids, field, obj._defaults[field])
                                  else:
                                      cr.execute(
          Severity: Major
          Found in openupgradelib/openupgrade.py - About 45 mins to fix

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

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

              Consider simplifying this complex logical expression.
              Open

                    if (
                      [...excludedTerms].some(
                        (term) =>
                          terms[term] === file ||
                          titleTerms[term] === file ||
              Severity: Major
              Found in docs/_static/searchtools.js - About 40 mins to fix

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

                def m2o_to_x2m(cr, model, table, field, source_field):
                Severity: Minor
                Found in openupgradelib/openupgrade.py - About 35 mins to fix

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

                  def _change_reference_refs_orm(
                  Severity: Minor
                  Found in openupgradelib/openupgrade_merge_records.py - About 35 mins to fix

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

                    def _delete_records_sql(
                    Severity: Minor
                    Found in openupgradelib/openupgrade_merge_records.py - About 35 mins to fix

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

                      def _change_reference_refs_sql(
                      Severity: Minor
                      Found in openupgradelib/openupgrade_merge_records.py - About 35 mins to fix

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

                        def _change_translations_sql(
                        Severity: Minor
                        Found in openupgradelib/openupgrade_merge_records.py - About 35 mins to fix

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

                          def convert_old_style_tax_tag_to_new(
                          Severity: Minor
                          Found in openupgradelib/openupgrade_130.py - About 35 mins to fix

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

                            def set_defaults(cr, pool, default_spec, force=False, use_orm=False):
                            Severity: Minor
                            Found in openupgradelib/openupgrade.py - About 35 mins to fix

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

                              def convert_field_html_string_13to14(
                              Severity: Minor
                              Found in openupgradelib/openupgrade_140.py - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language