OCA/openupgradelib

View on GitHub

Showing 163 of 163 total issues

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

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

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

    def update_module_moved_fields(cr, model, moved_fields, old_module, new_module):
    Severity: Minor
    Found in openupgradelib/openupgrade.py - About 35 mins to fix

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

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

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

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

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

          def _check_recurrence(env, model_name, record_ids, target_record_id, model_table=None):
          Severity: Minor
          Found in openupgradelib/openupgrade_merge_records.py - About 35 mins to fix

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

                openupgrade.logged_query(
                    env.cr,
                    """
                    DELETE FROM account_account_tag_account_tax_repartition_line_rel r
                    WHERE
            Severity: Major
            Found in openupgradelib/openupgrade_130.py and 3 other locations - About 35 mins to fix
            openupgradelib/openupgrade_130.py on lines 142..161
            openupgradelib/openupgrade_130.py on lines 163..182
            openupgradelib/openupgrade_130.py on lines 217..237

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

            def update_field_multilang(records, field, method):
                """Update a field in all available languages in the database.
            
                :param records:
                    Recordset to be updated.
            Severity: Minor
            Found in openupgradelib/openupgrade.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 4 locations. Consider refactoring.
            Open

                openupgrade.logged_query(
                    env.cr,
                    """
                    DELETE FROM account_account_tag_account_move_line_rel r
                    WHERE
            Severity: Major
            Found in openupgradelib/openupgrade_130.py and 3 other locations - About 35 mins to fix
            openupgradelib/openupgrade_130.py on lines 163..182
            openupgradelib/openupgrade_130.py on lines 195..215
            openupgradelib/openupgrade_130.py on lines 217..237

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

            def warn_possible_dataloss(cr, pool, old_module, fields):
                """
                Use that function in the following case:
                if a field of a model was moved from a 'A' module to a 'B' module.
                ('B' depend on 'A'),
            Severity: Minor
            Found in openupgradelib/openupgrade.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

            Function _check_recurrence has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def _check_recurrence(env, model_name, record_ids, target_record_id, model_table=None):
                if not model_table:
                    try:
                        model_table = env[model_name]._table
                    except KeyError:
            Severity: Minor
            Found in openupgradelib/openupgrade_merge_records.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

            Function deactivate_workflow_transitions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def deactivate_workflow_transitions(cr, model, transitions=None):
                """
                Disable workflow transitions for workflows on a given model.
                This can be necessary for automatic workflow transitions when writing
                to an object via the ORM in the post migration step.
            Severity: Minor
            Found in openupgradelib/openupgrade.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 4 locations. Consider refactoring.
            Open

                openupgrade.logged_query(
                    env.cr,
                    """
                    DELETE FROM account_account_tag_account_move_line_rel r
                    WHERE
            Severity: Major
            Found in openupgradelib/openupgrade_130.py and 3 other locations - About 35 mins to fix
            openupgradelib/openupgrade_130.py on lines 142..161
            openupgradelib/openupgrade_130.py on lines 195..215
            openupgradelib/openupgrade_130.py on lines 217..237

            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

                        cr.execute(
                            sql.SQL("ALTER TABLE {} RENAME CONSTRAINT {} TO {}").format(
                                sql.Identifier(new),
                                sql.Identifier(old_constraint),
                                sql.Identifier(new_constraint),
            Severity: Minor
            Found in openupgradelib/openupgrade.py and 1 other location - About 35 mins to fix
            openupgradelib/openupgrade.py on lines 2979..2982

            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

                            query = sql.SQL("ALTER TABLE {} ADD COLUMN {} {}").format(
                                sql.Identifier(table_name),
                                sql.Identifier(field_name),
                                sql.SQL(sql_type),
            Severity: Minor
            Found in openupgradelib/openupgrade.py and 1 other location - About 35 mins to fix
            openupgradelib/openupgrade.py on lines 882..886

            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 4 locations. Consider refactoring.
            Open

                openupgrade.logged_query(
                    env.cr,
                    """
                    DELETE FROM account_account_tag_account_tax_repartition_line_rel r
                    WHERE
            Severity: Major
            Found in openupgradelib/openupgrade_130.py and 3 other locations - About 35 mins to fix
            openupgradelib/openupgrade_130.py on lines 142..161
            openupgradelib/openupgrade_130.py on lines 163..182
            openupgradelib/openupgrade_130.py on lines 195..215

            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 4 locations. Consider refactoring.
            Open

                if affected > 0:
                    _logger.info(
                        'Converted tag "%s" to "+%s" on repartition line '
                        "template." % (report_line.name, report_line.tag_name)
            Severity: Major
            Found in openupgradelib/openupgrade_130.py and 3 other locations - About 30 mins to fix
            openupgradelib/openupgrade_130.py on lines 34..37
            openupgradelib/openupgrade_130.py on lines 72..75
            openupgradelib/openupgrade_130.py on lines 91..94

            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

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

                if affected > 0:
                    _logger.info(
                        'Converted tag "%s" to "+%s" on repartition line.'
                        % (report_line.name, report_line.tag_name)
            Severity: Major
            Found in openupgradelib/openupgrade_130.py and 3 other locations - About 30 mins to fix
            openupgradelib/openupgrade_130.py on lines 53..56
            openupgradelib/openupgrade_130.py on lines 72..75
            openupgradelib/openupgrade_130.py on lines 91..94

            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

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

                if affected > 0:
                    _logger.info(
                        'Converted tag "%s" to "-%s" on repartition line '
                        "template." % (report_line.name, report_line.tag_name)
            Severity: Major
            Found in openupgradelib/openupgrade_130.py and 3 other locations - About 30 mins to fix
            openupgradelib/openupgrade_130.py on lines 34..37
            openupgradelib/openupgrade_130.py on lines 53..56
            openupgradelib/openupgrade_130.py on lines 72..75

            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

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

                if affected > 0:
                    _logger.info(
                        'Converted tag "%s" to "-%s" on repartition line.'
                        % (report_line.name, report_line.tag_name)
            Severity: Major
            Found in openupgradelib/openupgrade_130.py and 3 other locations - About 30 mins to fix
            openupgradelib/openupgrade_130.py on lines 34..37
            openupgradelib/openupgrade_130.py on lines 53..56
            openupgradelib/openupgrade_130.py on lines 91..94

            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

            Function performTermsSearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              performTermsSearch: (searchTerms, excludedTerms) => {
                // prepare search
                const terms = Search._index.terms;
                const titleTerms = Search._index.titleterms;
                const filenames = Search._index.filenames;
            Severity: Minor
            Found in docs/_static/searchtools.js - About 25 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