OCA/server-tools

View on GitHub

Showing 317 of 317 total issues

Function button_confirm_login has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def button_confirm_login(self, cr, uid, ids, context=None):
        retval = super(fetchmail_server, self).button_confirm_login(
            cr, uid, ids, context)

        for this in self.browse(cr, uid, ids, context):
Severity: Minor
Found in fetchmail_attach_from_folder/model/fetchmail_server.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 datetimepicker_format has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        datetimepicker_format: function(odoo_format)
        {
            var result = '',
                map = {
                    '%a': 'D',
Severity: Minor
Found in field_rrule/static/src/js/field_rrule.js - About 1 hr to fix

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

                old_values = dict(
                    (d['id'], d) for d in self.sudo()
    Severity: Major
    Found in auditlog/models/rule.py and 3 other locations - About 1 hr to fix
    auditlog/models/rule.py on lines 292..293
    auditlog/models/rule.py on lines 376..377
    auditlog/models/rule.py on lines 414..415

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

    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 4 locations. Consider refactoring.
    Open

                old_values = dict(
                    (d['id'], d) for d in self.sudo()
    Severity: Major
    Found in auditlog/models/rule.py and 3 other locations - About 1 hr to fix
    auditlog/models/rule.py on lines 292..293
    auditlog/models/rule.py on lines 372..373
    auditlog/models/rule.py on lines 376..377

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

    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 4 locations. Consider refactoring.
    Open

                new_values = dict(
                    (d['id'], d) for d in new_record.sudo()
    Severity: Major
    Found in auditlog/models/rule.py and 3 other locations - About 1 hr to fix
    auditlog/models/rule.py on lines 372..373
    auditlog/models/rule.py on lines 376..377
    auditlog/models/rule.py on lines 414..415

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

    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 4 locations. Consider refactoring.
    Open

                new_values = dict(
                    (d['id'], d) for d in self.sudo()
    Severity: Major
    Found in auditlog/models/rule.py and 3 other locations - About 1 hr to fix
    auditlog/models/rule.py on lines 292..293
    auditlog/models/rule.py on lines 372..373
    auditlog/models/rule.py on lines 414..415

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

    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 input_changed has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            input_changed: function(e, noreset)
            {
                var input = jQuery(e.currentTarget),
                    current_item = input
                        .parentsUntil('form', 'table.rule_item'),
    Severity: Minor
    Found in field_rrule/static/src/js/field_rrule.js - About 1 hr to fix

      Function _load_wrapper has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _load_wrapper(self):
              """Create a new load patch method."""
              @api.model
              def wrapper(self, fields, data):
                  """Try to identify rows by other pseudo-unique keys.
      Severity: Minor
      Found in base_import_match/models/base_import.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 create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def create(self, values):
              values['report_name'] = self._format_template_name(
                  values.get('report_name', ''))
              if (values.get('report_type') in ['qweb-pdf', 'qweb-html'] and
                      values.get('report_name') and
      Severity: Minor
      Found in base_report_auto_create_qweb/models/report_xml.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 _generate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _generate(self, cr, uid, context):
              module_model = self.pool.get('ir.module.module')
              module_ids = context['active_ids']
      
              module_index = []
      Severity: Minor
      Found in base_module_doc_rst/wizard/tech_rst_guide.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 text_from_html has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def text_from_html(self, html_content, max_words=None, max_chars=None,
                             ellipsis=u"…", fail=False):
              """Extract text from an HTML field in a generator.
      
              :param str html_content:
      Severity: Minor
      Found in html_text/models/ir_fields_converter.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 _compute_label has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compute_label(self):
              """Column label in a user-friendly format and language."""
              for one in self:
                  parts = list()
                  for num in range(1, 5):
      Severity: Minor
      Found in base_export_manager/models/ir_exports_line.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 _restrict_field_access_adjust_field_modifiers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _restrict_field_access_adjust_field_modifiers(self, field_node,
                                                            modifiers):
              """inject a readonly modifier to make non-writable fields in a form
              readonly"""
              # TODO: this can be fooled by embedded views

      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

          @api.multi
          def field_n(self, n, only_name=False):
              """Helper to choose the field according to its indentation level.
      
              :param int n:
      Severity: Major
      Found in base_export_manager/models/ir_exports_line.py and 1 other location - About 1 hr to fix
      base_export_manager/models/ir_exports_line.py on lines 208..219

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

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

          def execute(self, cr, uid, ids, sqlquery, sqlparams=None, metadata=False,
                      context=None):
              """Executes SQL and returns a list of rows.
      
                  "sqlparams" can be a dict of values, that can be referenced in
      Severity: Minor
      Found in base_external_dbsource/base_external_dbsource.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

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

          @api.multi
          def model_n(self, n, only_name=False):
              """Helper to choose the model according to its indentation level.
      
              :param int n:
      Severity: Major
      Found in base_export_manager/models/ir_exports_line.py and 1 other location - About 1 hr to fix
      base_export_manager/models/ir_exports_line.py on lines 195..206

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

      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

                  begin_inactivity = now.replace(
                      hour=int(self.inactivity_hour_begin),
                      minute=int((self.inactivity_hour_begin % 1) * 60),
      Severity: Major
      Found in cron_inactivity_period/models/ir_cron_inactivity_period.py and 1 other location - About 1 hr to fix
      cron_inactivity_period/models/ir_cron_inactivity_period.py on lines 55..57

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

      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

                  end_inactivity = now.replace(
                      hour=int(self.inactivity_hour_end),
                      minute=int((self.inactivity_hour_end % 1) * 60),
      Severity: Major
      Found in cron_inactivity_period/models/ir_cron_inactivity_period.py and 1 other location - About 1 hr to fix
      cron_inactivity_period/models/ir_cron_inactivity_period.py on lines 51..53

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

      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 message_route_verify has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def message_route_verify(
      Severity: Major
      Found in fetchmail_notify_error_to_sender/mail_thread.py - About 1 hr to fix

        Function convert_to_cache_parse_data_rrule has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def convert_to_cache_parse_data_rrule(self, record, data):
                """parse a data dictionary from the database"""
                return {
                    key: fields.Datetime.from_string(value)
                    if '_%s' % key in _RRULE_DATETIME_FIELDS
        Severity: Minor
        Found in field_rrule/field_rrule.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