CastagnaIT/plugin.video.netflix

View on GitHub

Showing 103 of 373 total issues

Function on_playback_tick has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
Open

    def on_playback_tick(self):
        """
        Notify to action managers that an second of playback has elapsed
        """
        if self.active_player_id is not None:
Severity: Minor
Found in resources/lib/services/playback/action_controller.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 create_database has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def create_database(config):
    """Create a new database"""
    db_name = config.pop('database', None)
    LOG.debug('The MySQL database {} does not exist, creating a new one', db_name)
    conn = mysql.connector.connect(**config)
Severity: Minor
Found in resources/lib/database/db_create_mysql.py - About 1 hr to fix

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

            def _get_manifest(self, viewable_id, esn, challenge, sid):
                if common.get_system_platform() != 'android' and (not challenge or not sid):
                    LOG.error('DRM session data not valid (Session ID: {}, Challenge: {})', challenge, sid)
        
                from pprint import pformat
        Severity: Minor
        Found in resources/lib/services/nfsession/msl/msl_handler.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 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 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 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