OCA/server-tools

View on GitHub

Showing 207 of 317 total issues

Function format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def format(self, record):
        response = super(OdooJsonDevFormatter, self).format(record)
        extra = {}
        reserved_attrs = list(RESERVED_ATTRS) + ["dbname", "pid"]
        for key, value in record.__dict__.items():
Severity: Minor
Found in logging_json/json_log.py - About 25 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_password has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_password(self, password):
        self.ensure_one()
        if not password:
            return True
        company_id = self.company_id
Severity: Minor
Found in password_security/models/res_users.py - About 25 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 message_route_verify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def message_route_verify(
        self, cr, uid, message, message_dict, route, update_author=True,
        assert_model=True, create_fallback=True, allow_private=False,
        context=None
    ):
Severity: Minor
Found in fetchmail_notify_error_to_sender/mail_thread.py - About 25 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 _object_doc2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _object_doc2(self, obj):
        modobj = self.pool.get(obj)
        strdocs = modobj.__doc__
        if not strdocs:
            return None
Severity: Minor
Found in base_module_doc_rst/report/ir_module_reference_print_graph.py - About 25 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 web_login has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def web_login(self, *args, **kwargs):
        """Add MFA logic to the web_login action in Home

        Overview:
            * Call web_login in Home
Severity: Minor
Found in auth_totp/controllers/main.py - About 25 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 read_group has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def read_group(self, domain, fields, groupby, offset=0, limit=None,
                   orderby=False, lazy=True):
        """Restrict reading if we read an inaccessible field"""
        has_inaccessible_field = False
        has_inaccessible_field |= any(
Severity: Minor
Found in base_mixin_restrict_field_access/models/restrict_field_access_mixin.py - About 25 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_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _compute_hash(self):
        for attachment in self:
            if attachment.datas:
                attachment.internal_hash = hashlib.md5(
                    b64decode(attachment.datas)).hexdigest()
Severity: Minor
Found in attachment_metadata/models/attachment.py - About 25 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

Severity
Category
Status
Source
Language