CastagnaIT/plugin.video.netflix

View on GitHub

Showing 241 of 373 total issues

Function _limit_video_resolution has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

def _limit_video_resolution(video_tracks, has_drm_streams):
    """Limit max video resolution to user choice"""
    max_resolution = G.ADDON.getSettingString('stream_max_resolution')
    if max_resolution != '--':
        if max_resolution == 'SD 480p':
Severity: Minor
Found in resources/lib/services/nfsession/msl/converter.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 perpetual_path_request has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

    def perpetual_path_request(self, paths, length_params, perpetual_range_start=None,
                               request_size=apipaths.PATH_REQUEST_SIZE_PAGINATED, no_limit_req=False):
        """
        Perform a perpetual path request against the Shakti API to retrieve a possibly large video list.
        :param paths: The paths that compose the request
Severity: Minor
Found in resources/lib/services/nfsession/session/path_requests.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 _prepare_request_properties has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

    def _prepare_request_properties(self, endpoint_conf, kwargs):
        data = kwargs.get('data', {})
        custom_headers = kwargs.get('headers', {})
        custom_params = kwargs.get('params', {})
        params = {}
Severity: Minor
Found in resources/lib/services/nfsession/session/http_requests.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 login has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

def login(ask_credentials=True):
    """Perform a login"""
    try:
        is_success = False
        credentials = None
Severity: Minor
Found in resources/lib/utils/api_requests.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_mainmenu_listing has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

def build_mainmenu_listing(loco_list):
    """Builds the main menu listing (my list, continue watching, etc.)"""
    from resources.lib.kodi.context_menu import generate_context_menu_mainmenu
    directory_items = []
    common_data = get_common_data()

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 _sync_my_list_ops has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

    def _sync_my_list_ops(self, videoids_tasks, exp_tvshows_videoids_values, exp_movies_videoids_values):
        # Get videoids from the My list (of the chosen profile)
        # pylint: disable=not-callable
        mylist_video_id_list, mylist_video_id_list_type = self.ext_func_get_mylist_videoids_profile_switch()

Severity: Minor
Found in resources/lib/kodi/library.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 set_watched_status has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

def set_watched_status(list_item: ListItemW, video_data, common_data):
    """Check and set progress status (watched and resume)"""
    if not common_data['set_watched_status']:
        return
    video_id = str(video_data['summary']['value']['id'])
Severity: Minor
Found in resources/lib/kodi/infolabels.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 get_license has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

    def get_license(self, license_data):
        """
        Requests and returns a license for the given challenge and sid

        :param license_data: The license data provided by isa
Severity: Minor
Found in resources/lib/services/nfsession/msl/msl_handler.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 show_export_dialog has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

    def show_export_dialog(self, mediatype=None):
        """Ask the user if he wants to export NFO for movies and/or tvshows, this override the default settings"""
        if not self.export_enabled or (not self.movie_prompt_dialog and not self.tvshow_prompt_dialog):
            return
        ask_message_typelist = []
Severity: Minor
Found in resources/lib/kodi/nfo.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 get_quality_infos has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

def get_quality_infos(delivery, video_codec_hint):
    """Return audio and video quality infolabels"""
    quality_infos = {}
    if delivery:
        if delivery.get('hasUltraHD', False):  # 4k only with HEVC codec
Severity: Minor
Found in resources/lib/kodi/infolabels.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_contents has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

def list_contents(perpetual_range_start):
    """Return a chunked list of all video IDs (movies, shows) contained in the add-on library database"""
    perpetual_range_start = int(perpetual_range_start) if perpetual_range_start else 0
    number_of_requests = 2
    video_id_list = G.SHARED_DB.get_all_video_id_list()
Severity: Minor
Found in resources/lib/kodi/library_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 _convert_video_track has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _convert_video_track(index, video_track, period, protection, has_drm_streams, cdn_index, movie_id, pts_offset):
Severity: Major
Found in resources/lib/services/nfsession/msl/converter.py - About 1 hr to fix

    Function add_info_list_item has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def add_info_list_item(list_item: ListItemW, videoid, item, raw_data, is_in_mylist, common_data, art_item=None,
    Severity: Major
    Found in resources/lib/kodi/infolabels.py - About 1 hr to fix

      Function allow_execution_decorator has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

      def allow_execution_decorator(check_addon=True, check_lib=False, inject_videoid=False):
          def allow_execution(func):
              """Decorator that catch exceptions"""
              @wraps(func)
              def wrapper(*args, **kwargs):
      Severity: Minor
      Found in resources/lib/navigation/keymaps.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 _get_identifier has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

      def _get_identifier(fixed_identifier, identify_from_kwarg_name,
                          identify_append_from_kwarg_name, identify_fallback_arg_index, args, kwargs):
          """Return the identifier to use with the caching_decorator"""
          # LOG.debug('Get_identifier args: {}', args)
          # LOG.debug('Get_identifier kwargs: {}', kwargs)
      Severity: Minor
      Found in resources/lib/common/cache_utils.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 _create_video_item has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

      def _create_video_item(videoid_value, video, video_list, perpetual_range_start, common_data):  # pylint: disable=unused-argument
          if common_data['is_supplemental_type']:
              # 10/10/2022 Broken api? the video trailers are not more identified as supplemental type but as movie type
              # as workaround we check the data type
              videoid = common.VideoId(supplementalid=videoid_value)
      Severity: Minor
      Found in resources/lib/services/nfsession/directorybuilder/dir_builder_items.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 import_library has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

          def import_library(self, path):
              """
              Imports an already existing exported STRM library into the add-on library database,
              allows you to restore an existing library, by avoiding to recreate it from scratch.
              This operations also update the missing tv shows seasons and episodes, and automatically
      Severity: Minor
      Found in resources/lib/kodi/library.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 generate_context_menu_items has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

      def generate_context_menu_items(videoid, is_in_mylist, perpetual_range_start=None, add_remove_watched_status=False,
                                      trackid=None):
          """Generate context menu items for a listitem"""
          items = []
      
      
      Severity: Minor
      Found in resources/lib/kodi/context_menu.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 on_tick has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

          def on_tick(self, player_state):
              if player_state['nf_is_ads_stream']:
                  return
              if self.lock_events:
                  return
      Severity: Minor
      Found in resources/lib/services/playback/am_video_events.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 add_folders_to_library has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

          def add_folders_to_library(self, pathitems):  # pylint: disable=unused-argument
              from xml.dom import minidom
              from xbmcvfs import translatePath
              sources_xml_path = translatePath('special://userdata/sources.xml')
              if common.file_exists(sources_xml_path):
      Severity: Minor
      Found in resources/lib/navigation/library.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