airbnb/superset

View on GitHub
superset/utils/cache.py

Summary

Maintainability
C
1 day
Test Coverage

Function etag_cache has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
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,
Severity: Minor
Found in superset/utils/cache.py - About 6 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 set_and_log_cache has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def set_and_log_cache(
Severity: Minor
Found in superset/utils/cache.py - About 35 mins to fix

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

    def etag_cache(
    Severity: Minor
    Found in superset/utils/cache.py - About 35 mins to fix

      Function memoized_func has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      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)
      Severity: Minor
      Found in superset/utils/cache.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

      There are no issues that match your filters.

      Category
      Status