OCA/server-tools

View on GitHub

Showing 207 of 317 total issues

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

    def _check_name(self):
        for one in self:
            if not one.label:
                raise exceptions.ValidationError(
                    _("Field '%s' does not exist") % one.name)
Severity: Minor
Found in base_export_manager/models/ir_exports_line.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

                        for name in sorted(
                                n for n in remote.listdir(rec.folder)
                                if n.endswith(".dump.zip")
                        )[:-rec.days_to_keep]:
                            remote.unlink('%s/%s' % (rec.folder, name))
Severity: Major
Found in auto_backup/models/db_backup.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if basename.split('_')[0] not in keep_langs:
                            continue
                yield filepath
    Severity: Major
    Found in module_auto_update/addon_hash.py - About 45 mins to fix

      Function onchange_server_type has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def onchange_server_type(
      Severity: Minor
      Found in fetchmail_attach_from_folder/model/fetchmail_server.py - About 45 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

        Function _get_login_date has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _get_login_date(self, cr, uid, ids, name, args, context=None):
        Severity: Minor
        Found in base_concurrency/res_users.py - About 45 mins to fix

          Function _inherited_models has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _inherited_models(self, cr, uid, ids, field_name, arg, context=None):
          Severity: Minor
          Found in database_cleanup/model/purge_models.py - About 45 mins to fix

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

                def find(self, cr, uid, context=None):
                    """
                    Search for columns that are not in the corresponding model.
            
                    Group models by table to prevent false positives for columns
            Severity: Minor
            Found in database_cleanup/model/purge_columns.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

            Function _get_environment_config_by_name has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _get_environment_config_by_name(self, cr, uid, ids, field_names, arg, context):
            Severity: Minor
            Found in server_env_base_external_referentials/base_external_referentials.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      with open(backup) as cached:
                                          shutil.copyfileobj(cached, destiny)
                                  # Generate new backup
                                  else:
              Severity: Major
              Found in auto_backup/models/db_backup.py - About 45 mins to fix

                Function _get_is_template_template has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _get_is_template_template(self, cr, uid, ids, fields_name, arg,
                Severity: Minor
                Found in email_template_template/model/email_template.py - About 45 mins to fix

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

                      def _inverse_name(self):
                          """Get the fields from the name."""
                          for one in self:
                              # Field names can have up to only 4 indentation levels
                              parts = one.name.split("/")
                  Severity: Minor
                  Found in base_export_manager/models/ir_exports_line.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

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

                        def purge(self, cr, uid, ids, context=None):
                            """
                            Unlink tables upon manual confirmation.
                            """
                            lines = self.browse(cr, uid, ids, context=context)
                    Severity: Minor
                    Found in database_cleanup/model/purge_tables.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

                    Function check has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def check(self, cr, uid, model, mode='read', raise_exception=True,
                    Severity: Minor
                    Found in base_suspend_security/models/ir_model_access.py - About 45 mins to fix

                      Function write has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                  def write(self, cr, uid, ids, vals, context=None, **kwargs):
                      Severity: Minor
                      Found in base_field_validator/models/ir_model.py - About 45 mins to fix

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

                            def _get_views(self, cr, uid, module_id, context=None):
                                module_module_obj = self.pool.get('ir.module.module')
                                model_data_obj = self.pool.get('ir.model.data')
                                view_obj = self.pool.get('ir.ui.view')
                                report_obj = self.pool.get('ir.actions.report.xml')
                        Severity: Minor
                        Found in base_module_doc_rst/wizard/tech_rst_guide.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

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

                        def initialize_raven(config, client_cls=None):
                            '''
                            Setup an instance of :class:`raven.Client`.
                        
                            :param config: Sentry configuration
                        Severity: Minor
                        Found in sentry/__init__.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

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

                            def _compute_database(self):
                                table_names = []
                                for line in self.filtered(lambda x: x.model_id):
                                    model_obj = self.env.registry.get(line.model_id.model, False)
                                    if model_obj:
                        Severity: Minor
                        Found in module_uninstall_check/wizards/wizard_module_uninstall_line.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

                        Function _search has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def _search(self, args, offset=0, limit=None, order=None, count=False,
                        Severity: Minor
                        Found in base_mixin_restrict_field_access/models/restrict_field_access_mixin.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language