willforde/script.module.codequick

View on GitHub

Showing 45 of 65 total issues

File listing.py has 665 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
from __future__ import absolute_import

# Standard Library Imports
from time import strptime, strftime
Severity: Major
Found in script.module.codequick/lib/codequick/listing.py - About 1 day to fix

    File youtube.py has 488 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    from __future__ import absolute_import
    
    # Standard Library Imports
    import logging
    Severity: Minor
    Found in script.module.codequick/lib/codequick/youtube.py - About 7 hrs to fix

      File urlquick.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      #
      # The MIT License (MIT)
      #
      Severity: Minor
      Found in script.module.codequick/lib/urlquick.py - About 4 hrs to fix

        File script.py has 301 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        from __future__ import absolute_import
        
        # Standard Library Imports
        import logging
        Severity: Minor
        Found in script.module.codequick/lib/codequick/script.py - About 3 hrs to fix

          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

          File support.py has 280 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          from __future__ import absolute_import
          
          # Standard Library Imports
          import importlib
          Severity: Minor
          Found in script.module.codequick/lib/codequick/support.py - About 2 hrs to fix

            Function request_videos has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def request_videos(self, ids):
                    """
                    Return all requested videos from cache.
            
                    If requested video(s) are not cached, the video data will be
            Severity: Minor
            Found in script.module.codequick/lib/codequick/youtube.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 __setitem__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def __setitem__(self, key, value):
                    if value is None or value == "":
                        logger.debug("Ignoring empty infolable: '%s'", key)
                        return None
            
            
            Severity: Minor
            Found in script.module.codequick/lib/codequick/listing.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 run_delayed has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def run_delayed(self, exception=None):
                    """Execute all delayed callbacks, if any."""
                    if self.registered_delayed:
                        # Time before executing callbacks
                        start_time = time.time()
            Severity: Minor
            Found in script.module.codequick/lib/codequick/support.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 parse_qs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def parse_qs(qs, keep_blank_values=False, strict_parsing=False):
                """
                Parse a "urlencoded" query string, and return the data as a dictionary.
            
                Parse a query string given as a string or unicode argument (data of type application/x-www-form- urlencoded).
            Severity: Minor
            Found in script.module.codequick/lib/codequick/utils.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 _process_results has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def _process_results(self, resolved):
                    """
                    Construct playable listitem and send to kodi.
            
                    :param resolved: The resolved url to send back to kodi.
            Severity: Minor
            Found in script.module.codequick/lib/codequick/resolver.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 extract_source has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def extract_source(self, url, quality=None, **params):
                    """
                    Extract video URL using "YouTube.DL".
            
                    YouTube.DL provides access to hundreds of sites.
            Severity: Minor
            Found in script.module.codequick/lib/codequick/resolver.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 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 from_dict has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def from_dict(
            Severity: Major
            Found in script.module.codequick/lib/codequick/listing.py - About 1 hr to fix

              Function valid_playlistid has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def valid_playlistid(self, contentid):
                      """
                      Return a valid playlist uuid.
              
                      Contentid can be a channel uuid, playlist uuid or channel uploads uuid.
              Severity: Minor
              Found in script.module.codequick/lib/codequick/youtube.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 build_path has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              def build_path(callback=None, args=None, query=None, **extra_query):
                  """
                  Build addon url that can be passed to kodi for kodi to use when calling listitems.
              
                  :param callback: [opt] The route selector path referencing the callback object. (default => current route selector)
              Severity: Minor
              Found in script.module.codequick/lib/codequick/support.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 __getitem__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __getitem__(self, key):
                      if key in self.buffer:
                          return self.buffer[key]
                      else:
                          item = self.cur.execute("SELECT value, timestamp FROM itemcache WHERE key = ?", (key,)).fetchone()
              Severity: Minor
              Found in script.module.codequick/lib/codequick/storage.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 _connect_v3 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _connect_v3(self, api_type, query, loop=False):
                      """
                      Send API request and return response as a json object.
              
                      :param str api_type: The type of api request to make.
              Severity: Minor
              Found in script.module.codequick/lib/codequick/youtube.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 from_dict has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def from_dict(
                          cls,
                          callback,
                          label,
                          art=None,
              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

              Severity
              Category
              Status
              Source
              Language