willforde/script.module.codequick

View on GitHub
script.module.codequick/lib/codequick/route.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function send_to_kodi has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def send_to_kodi(handle, session):
    """Handle the processing of the listitems."""
    # Guess the contenty type
    if session["content_type"] == -1:
        kodi_listitems = []
Severity: Minor
Found in script.module.codequick/lib/codequick/route.py - About 2 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 validate_listitems has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def validate_listitems(raw_listitems):
    """Check if we have a vialid set of listitems."""

    # Convert a generator of listitems into a list of listitems
    if inspect.isgenerator(raw_listitems):
Severity: Minor
Found in script.module.codequick/lib/codequick/route.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 build_sortmethods has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def build_sortmethods(manualsort, autosort):  # type: (list, set) -> list
    """Merge manual & auto sortmethod together."""
    if autosort:
        # Add unsorted sort method if not sorted by date and no manually set sortmethods are given
        if not (manualsort or xbmcplugin.SORT_METHOD_DATE in autosort):
Severity: Minor
Found in script.module.codequick/lib/codequick/route.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 __call__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, route, args, kwargs):
        cache_ttl = getattr(self, "cache_ttl", -1)
        cache = Cache("listitem_cache.sqlite", cache_ttl * 60) if cache_ttl >= 0 else None
        session_id = get_session_id()

Severity: Minor
Found in script.module.codequick/lib/codequick/route.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

There are no issues that match your filters.

Category
Status