marrow/cache

View on GitHub

Showing 4 of 6 total issues

Function __call__ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, wrapped, instance, args, kw):
        prefix = self.prefix if self.prefix else resolve(wrapped)
        
        reference = self.reference
        if reference and isinstance(instance, Document):
Severity: Minor
Found in marrow/cache/model.py - About 1 hr 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 memoize has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def memoize(cls, prefix=None, reference=None, expires=utcnow, weeks=0, days=0, hours=0, minutes=0, seconds=0, refresh=False, populate=True):
Severity: Major
Found in marrow/cache/model.py - About 1 hr to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, manager, expiry, prefix=None, reference=False, refresh=False, populate=True, processor=None):
    Severity: Major
    Found in marrow/cache/model.py - About 50 mins to fix

      Function generate_expiry has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def generate_expiry(cls, expires, weeks, days, hours, minutes, seconds):
      Severity: Minor
      Found in marrow/cache/model.py - About 45 mins to fix
        Severity
        Category
        Status
        Source
        Language