superset/utils/cache.py
Function etag_cache
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
Open
def etag_cache(
cache: Cache = cache_manager.cache,
get_last_modified: Callable[..., datetime] | None = None,
max_age: int | float = app.config["CACHE_DEFAULT_TIMEOUT"],
raise_for_access: Callable[..., Any] | 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 set_and_log_cache
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def set_and_log_cache(
Function etag_cache
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def etag_cache(
Function memoized_func
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def memoized_func(key: str, cache: Cache = cache_manager.cache) -> Callable[..., Any]:
"""
Decorator with configurable key and cache backend.
@memoized_func(key="{a}+{b}", cache=cache_manager.data_cache)
- 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"