Showing 91 of 337 total issues
Function _get_manifest
has a Cognitive Complexity of 16 (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
- Read upRead up
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()
- Read upRead up
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']['id'])
- Read upRead up
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 = []
- Read upRead up
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(item, video_codec_hint):
"""Return audio and video quality infolabels"""
quality_infos = {}
delivery = item.get('delivery')
if delivery:
- Read upRead up
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_items_previous_next_page
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def add_items_previous_next_page(directory_items, pathitems, perpetual_range_selector, sub_genre_id=None,
path_params=None):
if pathitems and perpetual_range_selector:
if 'previous_start' in perpetual_range_selector:
params = {'perpetual_range_start': perpetual_range_selector.get('previous_start'),
- Read upRead up
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()
- Read upRead up
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 14 (exceeds 10 allowed). Consider refactoring. Open
def login(ask_credentials=True):
"""Perform a login"""
try:
credentials = None
is_login_with_credentials = True
- Read upRead up
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
- Read upRead up
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):
"""Generate context menu items for a listitem"""
items = []
if videoid.mediatype not in [common.VideoId.SUPPLEMENTAL, common.VideoId.EPISODE]:
- Read upRead up
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):
- Read upRead up
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)
- Read upRead up
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_video_listing
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_video_listing(video_list, menu_data, sub_genre_id=None, pathitems=None, perpetual_range_start=None,
Function exec_query
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def exec_query(row_id, search_type, search_params, search_value, perpetual_range_start, dir_update_listing,
Function add_info_list_item
has 7 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):
Function cache_output
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def cache_output(bucket, fixed_identifier=None,
Function on_playback_started
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def on_playback_started(self, player_state):
is_enabled = G.ADDON.getSettingBool('StreamContinuityManager_enabled')
if is_enabled:
# Get user saved preferences
self.sc_settings = G.SHARED_DB.get_stream_continuity(G.LOCAL_DB.get_active_profile_guid(),
- Read upRead up
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 _save_system_info
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def _save_system_info():
# Ask to save to a file
filename = 'NFSystemInfo.txt'
path = ui.show_browse_dialog(f'{common.get_local_string(30603)} - {filename}')
if not path:
- Read upRead up
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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_info(videoid, item, raw_data, profile_language_code='', delayed_db_op=False, common_data=dict):
Function on_tick
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def on_tick(self, player_state):
if self.lock_events:
return
if self.is_player_in_pause and (self.tick_elapsed - self.last_tick_count) >= 1800:
# When the player is paused for more than 30 minutes we interrupt the sending of events (1800secs=30m)
- Read upRead up
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"