ingadhoc/odoo-support

View on GitHub

Showing 66 of 66 total issues

File database.py has 481 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- encoding: utf-8 -*-
import os
import shutil
from datetime import datetime
from openerp import fields, models, api, _, modules
Severity: Minor
Found in database_tools/models/database.py - About 7 hrs to fix

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

        @api.multi
        def action_modules(self):
            self.ensure_one()
            action = self.env['ir.model.data'].xmlid_to_object(
                'adhoc_modules_server.action_adhoc_module_from_category')
    Severity: Major
    Found in adhoc_modules_server/models/adhoc_module_category.py and 1 other location - About 4 hrs to fix
    adhoc_modules/models/adhoc_module_category.py on lines 368..383

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

    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 action_modules(self):
            self.ensure_one()
            action = self.env['ir.model.data'].xmlid_to_object(
                'adhoc_modules.action_adhoc_ir_module_module')
    Severity: Major
    Found in adhoc_modules/models/adhoc_module_category.py and 1 other location - About 4 hrs to fix
    adhoc_modules_server/models/adhoc_module_category.py on lines 93..104

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

    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 action_subcategories(self):
            self.ensure_one()
            action = self.env['ir.model.data'].xmlid_to_object(
                'adhoc_modules_server.action_adhoc_module_category')
    Severity: Major
    Found in adhoc_modules_server/models/adhoc_module_category.py and 1 other location - About 4 hrs to fix
    adhoc_modules/models/adhoc_module_category.py on lines 353..366

    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

        @api.multi
        def action_subcategories(self):
            self.ensure_one()
            action = self.env['ir.model.data'].xmlid_to_object(
                'adhoc_modules.action_adhoc_module_category')
    Severity: Major
    Found in adhoc_modules/models/adhoc_module_category.py and 1 other location - About 4 hrs to fix
    adhoc_modules_server/models/adhoc_module_category.py on lines 77..91

    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

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

        def scan_repository(self):
            self.ensure_one()
            _logger.info("Scaning repository %s" % (self.name))
            res = [0, 0]    # [update, add]
            errors = []
    Severity: Minor
    Found in adhoc_modules_server/models/adhoc_module_repository.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

    File ir_module.py has 334 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    ##############################################################################
    # For copyright and license notices, see __openerp__.py file in module root
    # directory
    ##############################################################################
    Severity: Minor
    Found in adhoc_modules/models/ir_module.py - About 4 hrs to fix

      Function get_modules_availabilty has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_modules_availabilty(self):
              states = ['installed', 'to upgrade', 'to remove', 'to install']
              force = []
              packages = []
              not_installable = []
      Severity: Minor
      Found in database_tools/models/ir_module_module.py - About 2 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 database_backup has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def database_backup(
                  self, bu_type='manual',
                  backup_format='zip', backup_name=False, keep_till_date=False):
              """Returns a dictionary where:
              * keys = database name
      Severity: Minor
      Found in database_tools/models/database.py - About 2 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 restore_db has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def restore_db(
                  self, admin_pass, db_name, file_path, file_name,
                  backups_state, remote_server=False, overwrite=False):
              _logger.info(
                  "Starting restore process with data:\n"
      Severity: Minor
      Found in database_tools/controllers/db.py - About 2 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 _set_to_upgrade has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def _set_to_upgrade(self):
              """
              Igual que button upgrade pero no ejecuta automaticamente (ni devuelve
              wizard)
              Ademas sacamos el update list para que sea mas rapido
      Severity: Minor
      Found in database_tools/models/ir_module_module.py - About 2 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 adhoc_module_category.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      ##############################################################################
      # For copyright and license notices, see __openerp__.py file in module root
      # directory
      ##############################################################################
      Severity: Minor
      Found in adhoc_modules/models/adhoc_module_category.py - About 2 hrs to fix

        AdhocModuleModule has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class AdhocModuleModule(models.Model):
            _inherit = 'ir.module.module'
            # nos parece mas facil ver el nombre tecnico directamente, ayuda mucho
            # en los m2m_tags
            _rec_name = 'name'
        Severity: Minor
        Found in adhoc_modules/models/ir_module.py - About 2 hrs to fix

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

              @api.multi
              def set_to_uninstall_not_installable_modules(self):
                  """
                  We inherit this function to install auto install modules
                  """
          Severity: Major
          Found in adhoc_modules/models/db_configuration.py and 1 other location - About 2 hrs to fix
          adhoc_modules/models/db_configuration.py on lines 70..79

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

          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

          db_database has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class db_database(models.Model):
          
              _name = 'db.database'
          
              @api.model
          Severity: Minor
          Found in database_tools/models/database.py - About 2 hrs to fix

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

                @api.multi
                def set_to_install_unmet_deps(self):
                    """
                    We inherit this function to install auto install modules
                    """
            Severity: Major
            Found in adhoc_modules/models/db_configuration.py and 1 other location - About 2 hrs to fix
            adhoc_modules/models/db_configuration.py on lines 81..91

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

            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 fetch_mail(self):
                    if get_mode():
                        raise Warning(_(
                            "You Can not Fetch Mail Because Odoo is in %s mode.") % (
            Severity: Major
            Found in server_mode_fetchmail/fetchmail.py and 1 other location - About 1 hr to fix
            server_mode_fetchmail/fetchmail.py on lines 35..41

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

            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 button_confirm_login(self):
                    if get_mode():
                        raise Warning(_(
                            "You Can not Confirm & Test Because Odoo is in %s mode.") % (
            Severity: Major
            Found in server_mode_fetchmail/fetchmail.py and 1 other location - About 1 hr to fix
            server_mode_fetchmail/fetchmail.py on lines 43..49

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

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

            def button_install(self):
                # we add this check if modules are uninstallable so we can raise an error
                # by default, modules is not installed but user dont understand why
                def check_uninstallable(modules):
                    newstate = 'to install'
            Severity: Minor
            Found in adhoc_modules/models/ir_module.py - About 1 hr 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 update_adhoc_categories has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def update_adhoc_categories(self, client):
                    contract_id = self._context.get('contract_id')
                    fields = [
                        'name',
                        'code',
            Severity: Minor
            Found in adhoc_modules/models/support.py - About 1 hr 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