File log.py
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
Function log_with_context
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def log_with_context( # pylint: disable=too-many-locals,too-many-arguments
self,
action: str,
duration: timedelta | None = None,
object_ref: str | None = None,
- Read upRead up
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 log
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def log( # pylint: disable=too-many-arguments
Function log
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def log( # pylint: disable=too-many-arguments
Function _wrapper
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _wrapper(
self,
f: Callable[..., Any],
action: str | Callable[..., str] | None = None,
object_ref: str | Callable[..., str] | Literal[False] | None = None,
- Read upRead up
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 log
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def log( # pylint: disable=too-many-arguments,too-many-locals
Function log_with_context
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def log_with_context( # pylint: disable=too-many-locals,too-many-arguments
Function __call__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__(
Function _wrapper
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _wrapper(
Function collect_request_payload
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def collect_request_payload() -> dict[str, Any]:
"""Collect log payload identifiable from request context"""
if not request:
return {}
- Read upRead up
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"