OCA/server-tools

View on GitHub

Showing 317 of 317 total issues

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

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

                              if len(parts) > 4:
                                  raise exceptions.ValidationError(
                                      _("It's not allowed to have more than 4 levels depth: "
                                        "%s") % one.name)
                  Severity: Minor
                  Found in base_export_manager/models/ir_exports_line.py and 1 other location - About 45 mins to fix
                  base_export_manager/models/ir_exports_line.py on lines 162..164

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

                  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

                          'smtp_port': fields.function(
                              _get_smtp_conf,
                              string='SMTP Port',
                              type="integer",
                              multi='outgoing_mail_config',
                  Severity: Major
                  Found in mail_environment/env_mail.py and 2 other locations - About 45 mins to fix
                  mail_environment/env_mail.py on lines 71..76
                  mail_environment/env_mail.py on lines 79..84

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

                  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 _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

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

                          'smtp_pass': fields.function(
                              _get_smtp_conf,
                              string='Password',
                              type="char",
                              multi='outgoing_mail_config',
                  Severity: Major
                  Found in mail_environment/env_mail.py and 2 other locations - About 45 mins to fix
                  mail_environment/env_mail.py on lines 62..67
                  mail_environment/env_mail.py on lines 71..76

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

                  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 _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

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

                        def _get_smtp_conf(self, cr, uid, ids, name, args, context=None):
                    Severity: Minor
                    Found in mail_environment/env_mail.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language