willforde/script.module.codequick

View on GitHub

Showing 45 of 65 total issues

Function saved_searches has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def saved_searches(plugin, remove_entry=None, search=False, first_load=False, **extras):
    """
    Callback used to list all saved searches for the addon that called it.

    Useful to add search support to addon and will also keep track of previous searches.
Severity: Minor
Found in script.module.codequick/lib/codequick/search.py - About 55 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 build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def build(self):
        listitem = self.listitem
        isfolder = self._is_folder
        listitem.setProperty("folder", str(isfolder).lower())
        listitem.setProperty("isplayable", str(self._is_playable).lower())
Severity: Minor
Found in script.module.codequick/lib/codequick/listing.py - About 55 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 __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

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

    def __init__(self, name, ttl=None):
        super(PersistentDict, self).__init__(name)
        data = self._load()
        self._data = {}

Severity: Minor
Found in script.module.codequick/lib/codequick/storage.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 _process_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _process_item(self, count, url):
        """
        Process the playlist item and add to kodi playlist.

        :param int count: The part number of the item
Severity: Minor
Found in script.module.codequick/lib/codequick/resolver.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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, name, ttl=None):
        super(PersistentList, self).__init__(name)
        data = self._load()
        self._data = []

Severity: Minor
Found in script.module.codequick/lib/codequick/storage.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def execute(self, sqlquery, args, repeat=False):  # type: (str, tuple, bool) -> None
        self.cur.execute("BEGIN")
        try:
            self.cur.execute(sqlquery, args)

Severity: Minor
Found in script.module.codequick/lib/codequick/storage.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 _close has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _close(self, listitem):  # type: (xbmcgui.ListItem) -> None
        video = {}
        subtitle = {}
        audio = {"channels": 2}

Severity: Minor
Found in script.module.codequick/lib/codequick/listing.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 get_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def get_info(key, addon_id=None):
        """
        Returns the value of an add-on property as a unicode string.

        Properties.
Severity: Minor
Found in script.module.codequick/lib/codequick/script.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 playlist has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def playlist(plugin, contentid, pagetoken=None, enable_playlists=True, loop=False):
Severity: Minor
Found in script.module.codequick/lib/codequick/youtube.py - About 35 mins to fix

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

    def saved_searches(plugin, remove_entry=None, search=False, first_load=False, **extras):
    Severity: Minor
    Found in script.module.codequick/lib/codequick/search.py - About 35 mins to fix

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

      def playlists(plugin, channel_id, show_all=True, pagetoken=None, loop=False):
      Severity: Minor
      Found in script.module.codequick/lib/codequick/youtube.py - About 35 mins to fix

        Function playlist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def playlist(plugin, contentid, pagetoken=None, enable_playlists=True, loop=False):
            """
            List all videos within youtube playlist
        
            :param Route plugin: Tools related to Route callbacks.
        Severity: Minor
        Found in script.module.codequick/lib/codequick/youtube.py - About 35 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 run_callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def run_callback(self, process_errors=True, redirect=None):
                """
                The starting point of the add-on.
        
                This function will handle the execution of the "callback" functions.
        Severity: Minor
        Found in script.module.codequick/lib/codequick/support.py - About 35 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 localize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def localize(string_id):
                """
                Returns a translated UI string from addon localization files.
        
                .. note::
        Severity: Minor
        Found in script.module.codequick/lib/codequick/script.py - About 35 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 playlists has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def playlists(plugin, channel_id, show_all=True, pagetoken=None, loop=False):
            """
            List all playlist for giving channel
        
            :param Route plugin: Tools related to Route callbacks.
        Severity: Minor
        Found in script.module.codequick/lib/codequick/youtube.py - About 35 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 get_route has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_route(self, path=None):  # type: (str) -> Route
                """
                Return the given route callback.
        
                :param str path: The route path, if not given defaults to current callback
        Severity: Minor
        Found in script.module.codequick/lib/codequick/support.py - About 35 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 send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def send(self, request, **kwargs):  # type: (PreparedRequest, ...) -> Response
                max_age = int(request.headers.pop("x-cache-max-age"))
                urlhash = hash_url(request) if max_age >= 0 else None
                cache = None
        
        
        Severity: Minor
        Found in script.module.codequick/lib/urlquick.py - About 35 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 _duration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def _duration(duration):
                """Converts duration from a string of 'hh:mm:ss' into seconds."""
                if isinstance(duration, (str, unicode_type)):
                    duration = duration.replace(";", ":").strip(":")
                    if ":" in duration:
        Severity: Minor
        Found in script.module.codequick/lib/codequick/listing.py - About 35 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 get_cache has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_cache(self, urlhash, max_age):  # type: (str, int) -> CacheRecord
                """Return a cached response if one exists."""
                result = self.execute("""SELECT key, response,
                strftime('%s', 'now') - strftime('%s', cached_date, 'unixepoch') < ? AS fresh
                FROM urlcache WHERE key = ?""", (max_age, urlhash))
        Severity: Minor
        Found in script.module.codequick/lib/urlquick.py - About 35 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

        Severity
        Category
        Status
        Source
        Language