OCA/server-tools

View on GitHub

Showing 207 of 317 total issues

Function onchange_company_id has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def onchange_company_id(self, cr, uid, ids, company_id, context=None):
        " update related fields "
        values = {}
        values['currency_id'] = False
        if not company_id:
Severity: Minor
Found in configuration_helper/config.py - About 55 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 _bind_http_remote_user has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _bind_http_remote_user(self, db_name):
        try:
            registry = openerp.registry(db_name)
            with registry.cursor() as cr:
                if AuthFromHttpRemoteUserInstalled._name not in registry:
Severity: Minor
Found in auth_from_http_remote_user/controllers/main.py - About 55 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 _get_download_links has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_download_links(self):
        def _is_connection_status_good(link):
            server = "openerp.com"
            status_good = False
            try:
Severity: Minor
Found in base_module_doc_rst/wizard/tech_rst_guide.py - About 55 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 fetch_mail has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def fetch_mail(self, cr, uid, ids, context=None):
        if context is None:
            context = {}

        check_original = []
Severity: Minor
Found in fetchmail_attach_from_folder/model/fetchmail_server.py - About 55 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 _module_data_uninstall has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _module_data_uninstall(self, cr, uid, modules_to_remove, context=None):
        """this function crashes for xmlids on undefined models or fields
        referring to undefined models"""
        if context is None:
            context = {}
Severity: Minor
Found in database_cleanup/model/purge_modules.py - About 55 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 authenticate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def authenticate(self, db, login, password, user_agent_env):
        """ Authenticate the user 'login' is password is ok or if
 is admin password. In the second case, send mail to user and admin."""
        user_id = super(ResUsers, self).authenticate(
            db, login, password, user_agent_env)
Severity: Minor
Found in auth_admin_passkey/models/res_users.py - About 55 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 _iter_inheritance_specs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _iter_inheritance_specs(self, spec):
        if spec.tag == 'data':
            for child in spec:
                for node, handler in self._iter_inheritance_specs(child):
                    yield node, handler
Severity: Minor
Found in base_view_inheritance_extension/models/ir_ui_view.py - About 55 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 _search has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _search(self, args, offset=0, limit=None, order=None, count=False,
                access_rights_uid=None):
        if not args:
            return super(RestrictFieldAccessMixin, self)._search(
                args, offset=offset, limit=limit, order=order, count=count,
Severity: Minor
Found in base_mixin_restrict_field_access/models/restrict_field_access_mixin.py - About 55 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 fields_view_get has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def fields_view_get(self, cr, uid, view_id=None, view_type='form',
Severity: Major
Found in server_environment/serv_config.py - About 50 mins to fix

    Function _import_data has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _import_data(self, cr, uid, flds, data, model_obj, table_obj, log):
    Severity: Major
    Found in import_odbc/import_odbc.py - About 50 mins to fix

      Function fields_view_get has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def fields_view_get(self, cr, user, view_id=None, view_type='form',
      Severity: Major
      Found in fetchmail_attach_from_folder/wizard/attach_mail_manually.py - About 50 mins to fix

        Function fields_view_get has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def fields_view_get(self, cr, user, view_id=None, view_type='form',
        Severity: Major
        Found in fetchmail_attach_from_folder/model/fetchmail_server.py - About 50 mins to fix

          Function _handle_callback_exception has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _handle_callback_exception(self, cr, uid, model_name, method_name,
          Severity: Major
          Found in scheduler_error_mailer/ir_cron.py - About 50 mins to fix

            Function read_group has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def read_group(self, domain, fields, groupby, offset=0, limit=None,
            Severity: Major
            Found in base_mixin_restrict_field_access/models/restrict_field_access_mixin.py - About 50 mins to fix

              Function create_logs has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def create_logs(self, uid, res_model, res_ids, method,
              Severity: Major
              Found in auditlog/models/rule.py - About 50 mins to fix

                Function execute has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def execute(self, cr, uid, ids, sqlquery, sqlparams=None, metadata=False,
                Severity: Major
                Found in base_external_dbsource/base_external_dbsource.py - About 50 mins to fix

                  Function fields_view_get has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def fields_view_get(self, cr, uid, view_id=None, view_type='form',
                  Severity: Major
                  Found in base_mixin_restrict_field_access/models/restrict_field_access_mixin.py - About 50 mins to fix

                    Function fields_view_get has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def fields_view_get(
                    Severity: Major
                    Found in mass_editing/wizard/mass_editing_wizard.py - About 50 mins to fix

                      Function render_tag_usertime has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def render_tag_usertime(self, element, template_attributes,
                                                  generated_attributes, qwebcontext):
                              tformat = template_attributes['usertime']
                              if not tformat:
                                  # No format, use default time and date formats from qwebcontext
                      Severity: Minor
                      Found in qweb_usertime/qweb.py - About 45 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

                      Avoid deeply nested control flow statements.
                      Open

                                              with rec.custom_tempdir():
                                                  db.dump_db(self.env.cr.dbname, destiny)
                                              backup = backup or destiny.name
                      Severity: Major
                      Found in auto_backup/models/db_backup.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language