OCA/server-tools

View on GitHub

Showing 207 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

        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

            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

            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

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

                def get_proximity_graph(self, cr, uid, module_id, context=None):
                    pool_obj = pooler.get_pool(cr.dbname)
                    module_obj = pool_obj.get('ir.module.module')
                    nodes = [('base', 'unknown')]
                    edges = []
            Severity: Minor
            Found in base_module_doc_rst/report/report_proximity_graph.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 import_run has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                def import_run(self, cr, uid, ids=None, context=None):
                    db_model = self.pool.get('base.external.dbsource')
                    actions = self.read(cr, uid, ids, ['id', 'exec_order'])
                    actions.sort(key=lambda x: (x['exec_order'], x['id']))
            
            Severity: Minor
            Found in import_odbc/import_odbc.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 _patch_methods has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                def _patch_methods(self):
                    """Patch ORM methods of models defined in rules to log their calls."""
                    updated = False
                    model_cache = self.pool._auditlog_model_cache
                    try:
            Severity: Minor
            Found in auditlog/models/rule.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 _run_import_get_record_mapping has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                def _run_import_get_record_mapping(
                    self, context, model, record, create_dummy=True,
                ):
                    current_field = self.env['ir.model.fields'].search([
                        ('name', '=', context.field_context.field_name),
            Severity: Minor
            Found in base_import_odoo/models/import_odoo_database.py - 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

            Function create has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def create(self, cr, uid, vals, context=None):
                    if context.get('active_model') and context.get('active_ids'):
                        model_obj = self.pool.get(context.get('active_model'))
                        model_field_obj = self.pool.get('ir.model.fields')
                        translation_obj = self.pool.get('ir.translation')
            Severity: Minor
            Found in mass_editing/wizard/mass_editing_wizard.py - 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

            Function _type_search has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def _type_search(self, cr, uid, obj, name, args, context=None):
                    result_ids = []
                    # read all incoming servers values
                    all_ids = self.search(cr, uid, [], context=context)
                    results = self.read(cr, uid, all_ids, ['id', 'type'], context=context)
            Severity: Minor
            Found in mail_environment/env_mail.py - 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

            Function _import_data has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                def _import_data(self, cr, uid, flds, data, model_obj, table_obj, log):
                    """Import data and returns error msg or empty string"""
            
                    def find_m2o(field_list):
                        """"Find index of first column with a one2many field"""
            Severity: Minor
            Found in import_odbc/import_odbc.py - 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

            Function web_login has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                def web_login(self, redirect=None, **kw):
                    if request.httprequest.method == 'POST':
                        ensure_db()
                        remote = request.httprequest.remote_addr
                        # Get registry and cursor
            Severity: Minor
            Found in auth_brute_force/controllers/controllers.py - 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

            Function fields_view_get has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                def fields_view_get(self, cr, user, view_id=None, view_type='form',
                                    context=None, toolbar=False, submenu=False):
                    result = super(fetchmail_server, self).fields_view_get(
                        cr, user, view_id, view_type, context, toolbar, submenu)
            
            
            Severity: Minor
            Found in fetchmail_attach_from_folder/model/fetchmail_server.py - 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

            Function purge has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                def purge(self, cr, uid, ids, context=None):
                    """
                    Unlink models upon manual confirmation.
                    """
                    model_pool = self.pool['ir.model']
            Severity: Minor
            Found in database_cleanup/model/purge_models.py - 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

            Function _register_hook has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                def _register_hook(self, cr, ids=None):
            
                    def make_name_search():
            
                        @api.model
            Severity: Minor
            Found in base_name_search_improved/models/ir_model.py - 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