kodi-czsk/plugin.video.sosac.ph

View on GitHub

Showing 27 of 88 total issues

Function run_custom has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

    def run_custom(self, params):
        if 'action' in params:
            icon = os.path.join(self.addon.getAddonInfo('path'), 'icon.png')
            if params['action'] == sosac.LIBRARY_ACTION_REMOVE_SUBSCRIPTION:
                subs = self.get_subs()
Severity: Minor
Found in resources/lib/sutils.py - About 1 day 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 add_item has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    def add_item(self, params):
        error = False
        if not 'refresh' in params:
            params['refresh'] = str(self.getSetting("refresh_time"))
        sub = {'name': params['name'], 'refresh': params[
Severity: Minor
Found in resources/lib/sutils.py - About 6 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 sosac.py has 434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: UTF-8 -*-
# /*
# *      Copyright (C) 2015 Libor Zoubek + jondas
# *
# *
Severity: Minor
Found in resources/lib/sosac.py - About 6 hrs to fix

    Function evalSchedules has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        def evalSchedules(self):
            if not self.scanRunning() and not self.isPlaying():
                notified = False
                util.info("SOSAC Loading subscriptions")
                subs = self.get_subs()
    Severity: Minor
    Found in resources/lib/sutils.py - About 5 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 list_videos has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def list_videos(self, url, filter=None, order_by=0, library=False):
            result = []
            data = util.request(url)
            json_video_array = json.loads(data)
            for video in json_video_array:
    Severity: Minor
    Found in resources/lib/sosac.py - About 4 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 sutils.py has 336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import util
    import xbmcprovider
    import xbmcutil
    import xbmcvfs
    import xbmcgui
    Severity: Minor
    Found in resources/lib/sutils.py - About 4 hrs to fix

      SosacContentProvider has 30 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SosacContentProvider(ContentProvider):
          ISO_639_1_CZECH = None
          par = None
      
          def __init__(self, username=None, password=None, filter=None, reverse_eps=False,
      Severity: Minor
      Found in resources/lib/sosac.py - About 3 hrs to fix

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

            def list_episodes(self, url):
                result = []
                data = util.request(url)
                json_series = json.loads(data)
                for series in json_series:
        Severity: Minor
        Found in resources/lib/sosac.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 list_series_letter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def list_series_letter(self, url, load_subs=True):
                result = []
                data = util.request(url)
                json_list = json.loads(data)
                subs = self.get_subscriptions() if load_subs else {}
        Severity: Minor
        Found in resources/lib/sosac.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 add_item_to_library has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_item_to_library(self, item_path, item_url):
                error = False
                new = False
                if item_path:
                    item_path = xbmc.translatePath(item_path)
        Severity: Minor
        Found in resources/lib/sutils.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 list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def list(self, url, filter=None):
                util.info("Examining url " + url)
        
                list_result = None
                if FILTER_URL_PARAM in url:
        Severity: Minor
        Found in resources/lib/sosac.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

        Avoid deeply nested control flow statements.
        Open

                                if self.dialog.iscanceled():
                                    return
                                if 'progress' in show:
        Severity: Major
        Found in resources/lib/sutils.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if self.dialog.iscanceled():
                                      return
                                  if 'progress' in video:
          Severity: Major
          Found in resources/lib/sutils.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if 'progress' in video:
                                        self.dialog.update(video['progress'])
                                    else:
                                        item = video['menu'][sosac.LIBRARY_MENU_ITEM_ADD]
                                        item["update"] = True
            Severity: Major
            Found in resources/lib/sutils.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if 'progress' in video:
                                          self.dialog.update(video['progress'])
                                      else:
                                          item = video['menu'][sosac.LIBRARY_MENU_ITEM_ADD]
                                          item["update"] = True
              Severity: Major
              Found in resources/lib/sutils.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if 'progress' in show:
                                            self.dialog.update(show['progress'])
                                        else:
                                            item = show['menu'][sosac.LIBRARY_MENU_ITEM_ADD]
                                            item["update"] = True
                Severity: Major
                Found in resources/lib/sutils.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if next_check < time.time():
                                              if not notified:
                                                  self.showNotification(
                                                      'Subscription', 'Chcecking')
                                                  notified = True
                  Severity: Major
                  Found in resources/lib/sutils.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if self.dialog.iscanceled():
                                                return
                                            if 'progress' in video:
                    Severity: Major
                    Found in resources/lib/sutils.py - About 45 mins to fix

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

                          def __init__(self, username=None, password=None, filter=None, reverse_eps=False,
                      Severity: Minor
                      Found in resources/lib/sosac.py - About 45 mins to fix

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

                                    def http_error_302(self, req, fp, code, msg, headers):
                        Severity: Minor
                        Found in resources/lib/sosac.py - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language