OCA/openupgradelib

View on GitHub

Showing 118 of 159 total issues

File openupgrade.py has 3117 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*- # pylint: disable=C8202
# Copyright 2011-2020 Therp BV <https://therp.nl>.
# Copyright 2016-2020 Tecnativa - Pedro M. Baeza.
# Copyright Odoo Community Association (OCA)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
Severity: Major
Found in openupgradelib/openupgrade.py - About 1 wk to fix

    File openupgrade_merge_records.py has 1004 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*- # pylint: disable=C8202
    # Copyright 2018 Tecnativa - Pedro M. Baeza
    # Copyright 2018 Opener B.V. - Stefan Rijnhart
    # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
    
    
    Severity: Major
    Found in openupgradelib/openupgrade_merge_records.py - About 2 days to fix

      Function apply_operations_by_field_type has a Cognitive Complexity of 124 (exceeds 5 allowed). Consider refactoring.
      Open

      def apply_operations_by_field_type(
          env,
          model_name,
          record_ids,
          target_record_id,
      Severity: Minor
      Found in openupgradelib/openupgrade_merge_records.py - About 2 days 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 set_defaults has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
      Open

      def set_defaults(cr, pool, default_spec, force=False, use_orm=False):
          """
          Set default value. Useful for fields that are newly required. Uses orm, so
          call from the post script.
      
      
      Severity: Minor
      Found in openupgradelib/openupgrade.py - About 2 days 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 Stemmer has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
      Open

      var Stemmer = function() {
      
        var step2list = {
          ational: 'ate',
          tional: 'tion',
      Severity: Minor
      Found in docs/_static/language_data.js - About 1 day 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_xml_node has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
      Open

      def convert_xml_node(
          node,
          attr_add=None,
          attr_rm=frozenset(),
          class_add="",
      Severity: Minor
      Found in openupgradelib/openupgrade_tools.py - About 1 day 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_generic has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

      def _change_generic(
          env,
          model_name,
          record_ids,
          target_record_id,
      Severity: Minor
      Found in openupgradelib/openupgrade_merge_records.py - About 6 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

      File openupgrade_160.py has 428 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright 2022 ACSONE SA/NV
      # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
      
      """This module provides simple tools for OpenUpgrade migration, specific for
      the >=16.0 migration.
      Severity: Minor
      Found in openupgradelib/openupgrade_160.py - About 6 hrs to fix

        Function disable_invalid_filters has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

        def disable_invalid_filters(env):
            """It analyzes all the existing active filters to check if they are still
            correct. If not, they are disabled for avoiding errors when clicking on
            them, or worse, if they are default filters when opening the model/action.
        
        
        Severity: Minor
        Found in openupgradelib/openupgrade.py - About 6 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 add_fields has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

        def add_fields(env, field_spec):
            """This method adds all the needed stuff for having a new field populated
            in the DB (SQL column, ir.model.fields entry, ir.model.data entry...).
        
            It's intended for being run in pre-migration scripts for pre-populating
        Severity: Minor
        Found in openupgradelib/openupgrade.py - About 6 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 Stemmer has 151 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Stemmer = function() {
        
          var step2list = {
            ational: 'ate',
            tional: 'tion',
        Severity: Major
        Found in docs/_static/language_data.js - About 6 hrs to fix

          Function rename_models has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
          Open

          def rename_models(cr, model_spec):
              """
              Rename models. Typically called in the pre script.
              :param model_spec: a list of tuples (old model name, new model name).
          
          
          Severity: Minor
          Found in openupgradelib/openupgrade.py - About 5 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

          File searchtools.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
           * searchtools.js
           * ~~~~~~~~~~~~~~~~
           *
           * Sphinx JavaScript utilities for the full-text search.
          Severity: Minor
          Found in docs/_static/searchtools.js - About 5 hrs to fix

            File openupgrade_120.py has 386 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*- # pylint: disable=C8202
            # Copyright 2019 Tecnativa - Jairo Llopis
            # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
            
            """Tools specific for migrating Odoo 11.0 to 12.0.
            Severity: Minor
            Found in openupgradelib/openupgrade_120.py - About 5 hrs to fix

              Function initOnKeyListeners has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                initOnKeyListeners: () => {
                  // only install a listener if it is really needed
                  if (
                    !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS &&
                    !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS
              Severity: Minor
              Found in docs/_static/doctools.js - About 5 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 logging has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

              def logging(args_details=False, step=False):
                  """
                  This is a decorator for any sub functions called in an OpenUpgrade script.
                  (pre or post migration script)
              
              
              Severity: Minor
              Found in openupgradelib/openupgrade.py - About 4 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 _change_foreign_key_refs has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

              def _change_foreign_key_refs(
                  env,
                  model_name,
                  record_ids,
                  target_record_id,
              Severity: Minor
              Found in openupgradelib/openupgrade_merge_records.py - About 4 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 stemWord has 109 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                this.stemWord = function (w) {
                  var stem;
                  var suffix;
                  var firstch;
                  var origword = w;
              Severity: Major
              Found in docs/_static/language_data.js - About 4 hrs to fix

                Function merge_records has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                def merge_records(
                    env,
                    model_name,
                    record_ids,
                    target_record_id,
                Severity: Minor
                Found in openupgradelib/openupgrade_merge_records.py - About 4 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 query has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                Open

                  query: (query) => {
                    const filenames = Search._index.filenames;
                    const docNames = Search._index.docnames;
                    const titles = Search._index.titles;
                    const allTitles = Search._index.alltitles;
                Severity: Minor
                Found in docs/_static/searchtools.js - About 3 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

                Severity
                Category
                Status
                Source
                Language