3Top/lru2layer

View on GitHub

Showing 5 of 32 total issues

Function lru2cache has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

def lru2cache(l1_maxsize=128, none_cache=False, typed=False, l2cache_name='l2cache', inst_attr='id'):
    """Least-recently-used cache decorator.

    If *l1_maxsize* is set to None, the LRU features are disabled and the cache
    can grow without bound.
Severity: Minor
Found in lru2cache/utils.py - About 7 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 _make_key has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _make_key(user_function, args, kwds, typed,
Severity: Major
Found in lru2cache/utils.py - About 1 hr to fix

    Function _make_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _make_key(user_function, args, kwds, typed,
                 kwd_mark = (object(),),
                 fasttypes = {int, str, frozenset, type(None)},
                 sorted=sorted, tuple=tuple, type=type, len=len, inst_attr='id'):
        'Make a cache key from optionally typed positional and keyword arguments'
    Severity: Minor
    Found in lru2cache/utils.py - About 45 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 l2wrapper has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def l2wrapper(key, user_function, none_cache, *args, **kwds):
    Severity: Minor
    Found in lru2cache/utils.py - About 35 mins to fix

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

      def lru2cache(l1_maxsize=128, none_cache=False, typed=False, l2cache_name='l2cache', inst_attr='id'):
      Severity: Minor
      Found in lru2cache/utils.py - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language