OCA/server-tools

View on GitHub
fetchmail_attach_from_folder/model/fetchmail_server.py

Summary

Maintainability
D
1 day
Test Coverage

Function fields_view_get has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def fields_view_get(self, cr, user, view_id=None, view_type='form',
                        context=None, toolbar=False, submenu=False):
        result = super(fetchmail_server, self).fields_view_get(
            cr, user, view_id, view_type, context, toolbar, submenu)

Severity: Minor
Found in fetchmail_attach_from_folder/model/fetchmail_server.py - About 3 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 attach_mail has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def attach_mail(self, connection, object_id, folder, mail_message, msgid):
        '''Return ids of messages created'''

        mail_message_ids = []

Severity: Minor
Found in fetchmail_attach_from_folder/model/fetchmail_server.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 apply_matching has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_matching(self, connection, folder, msgid, match_algorithm):
        '''Return ids of objects matched'''

        matched_object_ids = []

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

      Avoid deeply nested control flow statements.
      Open

                              if modifiers[field][modifier]:
                                  modifiers[field][modifier].insert(0, '|')
                              modifiers[field][modifier].append(
      Severity: Major
      Found in fetchmail_attach_from_folder/model/fetchmail_server.py - About 45 mins to fix

        Function attach_mail has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def attach_mail(self, connection, object_id, folder, mail_message, msgid):
        Severity: Minor
        Found in fetchmail_attach_from_folder/model/fetchmail_server.py - About 35 mins to fix

          Function handle_folder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_folder(self, connection, folder):
                  '''Return ids of objects matched'''
          
                  matched_object_ids = []
          
          
          Severity: Minor
          Found in fetchmail_attach_from_folder/model/fetchmail_server.py - About 35 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

          There are no issues that match your filters.

          Category
          Status