OCA/server-tools

View on GitHub

Showing 317 of 317 total issues

Function field_rrule has 300 lines of code (exceeds 25 allowed). Consider refactoring.
Open

openerp.field_rrule = function(instance)
{
    instance.field_rrule.FieldRRule = instance.web.form.AbstractField
    .extend(instance.web.form.ReinitializeFieldMixin, {
        template: 'FieldRRule',
Severity: Major
Found in field_rrule/static/src/js/field_rrule.js - About 1 day to fix

    File rule.py has 612 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # © 2015 ABF OSIELL <http://osiell.com>
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
    
    import logging
    Severity: Major
    Found in auditlog/models/rule.py - About 1 day to fix

      File import_odoo_database.py has 602 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      # © 2017 Therp BV <http://therp.nl>
      # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
      import logging
      try:
      Severity: Major
      Found in base_import_odoo/models/import_odoo_database.py - About 1 day to fix

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

                        elif field.ttype == "one2many":
                            all_fields["selection__" + field.name] = {
                                'type': 'selection',
                                'string': field_info[field.name]['string'],
                                'selection': [('set', s_set), ('remove', s_remove)]}
        Severity: Major
        Found in mass_editing/wizard/mass_editing_wizard.py and 1 other location - About 1 day to fix
        mass_editing/wizard/mass_editing_wizard.py on lines 91..105

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

        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

                        elif field.ttype == "many2one":
                            all_fields["selection__" + field.name] = {
                                'type': 'selection',
                                'string': field_info[field.name]['string'],
                                'selection': [('set', s_set), ('remove', s_remove)]}
        Severity: Major
        Found in mass_editing/wizard/mass_editing_wizard.py and 1 other location - About 1 day to fix
        mass_editing/wizard/mass_editing_wizard.py on lines 76..90

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

        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

        File module_prototyper.py has 457 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- encoding: utf-8 -*-
        # #############################################################################
        #
        #    OpenERP, Open Source Management Solution
        #    This module copyright (C) 2010 - 2014 Savoir-faire Linux
        Severity: Minor
        Found in module_prototyper/models/module_prototyper.py - About 7 hrs to fix

          Function _make_custom has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
          Open

              def _make_custom(self, message, use_active_ids, context_field_number):
                  """Instanciate a read method that log its calls."""
                  self.ensure_one()
                  log_type = self.log_type
          
          
          Severity: Minor
          Found in auditlog/models/rule.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 tech_rst_guide.py has 445 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          ##############################################################################
          #
          #    OpenERP, Open Source Management Solution
          #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
          Severity: Minor
          Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 6 hrs to fix

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

                    format_field_weekday: function(weekday)
                    {
                        switch(parseInt(weekday))
                        {
                            case 0: return instance.web._t('Monday');
            Severity: Major
            Found in field_rrule/static/src/js/field_rrule.js and 1 other location - About 5 hrs to fix
            field_rrule/static/src/js/field_rrule.js on lines 280..292

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

            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

                    format_field_freq: function(frequency)
                    {
                        switch(parseInt(frequency))
                        {
                            case 0: return instance.web._t('Yearly');
            Severity: Major
            Found in field_rrule/static/src/js/field_rrule.js and 1 other location - About 5 hrs to fix
            field_rrule/static/src/js/field_rrule.js on lines 267..279

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

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

                def _get_record_values_from_line(self, line):
                    """
                    Get super_calendar fields values from super_calendar_configurator_line
                    objects.
                    Check if the User value is a res.users.
            Severity: Minor
            Found in super_calendar/models/super_calendar_configurator.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

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

                @api.model
                def create(self, vals):
                    """ Insert model_name and model_model field values upon creation. """
                    if 'model_id' in vals and vals['model_id']:
                        model = self.env['ir.model'].browse(vals['model_id'])
            Severity: Major
            Found in auditlog/models/log.py and 1 other location - About 5 hrs to fix
            auditlog/models/log.py on lines 45..53

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

            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

                @api.multi
                def write(self, vals):
                    """ Update model_name and model_model field values to reflect model_id
                    changes. """
                    if 'model_id' in vals and vals['model_id']:
            Severity: Major
            Found in auditlog/models/log.py and 1 other location - About 5 hrs to fix
            auditlog/models/log.py on lines 36..43

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

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

            openerp.field_rrule = function(instance)
            {
                instance.field_rrule.FieldRRule = instance.web.form.AbstractField
                .extend(instance.web.form.ReinitializeFieldMixin, {
                    template: 'FieldRRule',
            Severity: Minor
            Found in field_rrule/static/src/js/field_rrule.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 _run_import_map_values has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

                def _run_import_map_values(self, context, data):
                    model = self.env[context.model_line.model_id.model]
                    for field_name in data.keys():
                        if not isinstance(
                                model._fields[field_name], fields._Relational
            Severity: Minor
            Found in base_import_odoo/models/import_odoo_database.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

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

                def _write_menus(self):
                    sl = ["",
                          "Menus",
                          "-------",
                          ""]
            Severity: Major
            Found in base_module_doc_rst/wizard/tech_rst_guide.py and 1 other location - About 5 hrs to fix
            base_module_doc_rst/wizard/tech_rst_guide.py on lines 194..208

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

            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

                def _write_views(self):
                    sl = ["",
                          "Views",
                          "-----",
                          ""]
            Severity: Major
            Found in base_module_doc_rst/wizard/tech_rst_guide.py and 1 other location - About 5 hrs to fix
            base_module_doc_rst/wizard/tech_rst_guide.py on lines 178..192

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

            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

                @api.multi
                @api.depends("field1_id")
                def _compute_model2_id(self):
                    """Get the related model for the second field."""
                    IrModel = self.env["ir.model"]
            Severity: Major
            Found in base_export_manager/models/ir_exports_line.py and 2 other locations - About 4 hrs to fix
            base_export_manager/models/ir_exports_line.py on lines 85..94
            base_export_manager/models/ir_exports_line.py on lines 96..105

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

            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

                @api.multi
                @api.depends("field3_id")
                def _compute_model4_id(self):
                    """Get the related model for the third field."""
                    IrModel = self.env["ir.model"]
            Severity: Major
            Found in base_export_manager/models/ir_exports_line.py and 2 other locations - About 4 hrs to fix
            base_export_manager/models/ir_exports_line.py on lines 74..83
            base_export_manager/models/ir_exports_line.py on lines 85..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 82.

            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

                def _create_log_line_on_create(
                        self, log, fields_list, new_values):
                    """Log field filled on a 'create' operation."""
                    log_line_model = self.env['auditlog.log.line']
                    for field_name in fields_list:
            Severity: Major
            Found in auditlog/models/rule.py and 1 other location - About 4 hrs to fix
            auditlog/models/rule.py on lines 573..585

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

            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