Showing 91 of 340 total issues
VideoId
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class VideoId:
"""Universal representation of a video id. Video IDs can be of multiple types:
- supplemental: a single identifier only for supplementalid, all other values must be None
- movie: a single identifier only for movieid, all other values must be None
- show: a single identifier only for tvshowid, all other values must be None
Function generate_android_esn
has a Cognitive Complexity of 27 (exceeds 10 allowed). Consider refactoring. Open
def generate_android_esn(wv_force_sec_lev=None):
"""Generate an ESN if on android or return the one from user_data"""
from resources.lib.common.device_utils import get_system_platform
if get_system_platform() == 'android':
import subprocess
- 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 _request
has a Cognitive Complexity of 27 (exceeds 10 allowed). Consider refactoring. Open
def _request(self, method, endpoint, session_refreshed, **kwargs):
endpoint_conf = ENDPOINTS[endpoint]
url = (_api_url(endpoint_conf['address'])
if endpoint_conf['is_api_call']
else _document_url(endpoint_conf['address'], 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 auto_scroll
has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring. Open
def auto_scroll(dir_items):
"""
Auto scroll the current viewed list to select the last partial watched or next episode to be watched,
works only with Sync of watched status with netflix
"""
- 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
File db_shared.py
has 431 lines of code (exceeds 400 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)
Copyright (C) 2019 Stefano Gottardo - @CastagnaIT (original implementation module)
Sharable database access and functions
Function get_shareddb_class
has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring. Open
def get_shareddb_class(use_mysql=False):
# Dynamically sets the inherit class
base_class = db_base_mysql.MySQLDatabase if use_mysql else db_base_sqlite.SQLiteDatabase
class NFSharedDatabase(base_class):
- 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
CacheManagement
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class CacheManagement:
"""Cache management"""
def __init__(self):
self._identifier_prefix = None
Function onNotification
has a Cognitive Complexity of 22 (exceeds 10 allowed). Consider refactoring. Open
def onNotification(self, sender, method, data): # pylint: disable=unused-argument,too-many-branches
"""
Callback for Kodi notifications that handles and dispatches playback events
"""
# WARNING: Do not get playerid from '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 _prepare_authentication_key_data
has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring. Open
def _prepare_authentication_key_data(data):
"""Check type of app used and prepare data for the service"""
from resources.lib.utils.cookies import convert_chrome_cookie
if (data['app_name'] == 'NFAuthenticationKey' and
data['app_system'] == 'Windows' and
- 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 _update_library
has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring. Open
def _update_library(self, videoids_tasks, exp_tvshows_videoids_values, show_prg_dialog, show_nfo_dialog,
clear_on_cancel):
# If set ask to user if want to export NFO files (override user custom NFO settings for videoids)
nfo_settings_override = None
if show_nfo_dialog:
- 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 _find_stream_index
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
def _find_stream_index(self, streams, stored_stream):
"""
Find the right stream index
in the case of episodes, it is possible that between different episodes some languages are
not present, so the indexes are changed, then you have to rely on the streams properties
- 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_id_default_audio_tracks
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
def _get_id_default_audio_tracks(manifest):
"""Get the track id of the audio track to be set as default"""
channels_stereo = ['1.0', '2.0']
channels_multi = ['5.1', '7.1']
is_prefer_stereo = G.ADDON.getSettingBool('prefer_audio_stereo')
- 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 _on_change
has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
def _on_change(self):
# Reinitialize the log settings
LOG.initialize(G.ADDON_ID, G.PLUGIN_HANDLE,
G.ADDON.getSettingBool('enable_debug'),
G.ADDON.getSettingBool('enable_timing'))
- 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_library_ctx_items
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
def _generate_library_ctx_items(videoid, lib_auto_upd_mode):
library_actions = []
allow_lib_operations = True
lib_is_sync_with_mylist = (G.ADDON.getSettingBool('lib_sync_mylist') and
lib_auto_upd_mode == 2)
- 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 compile_jobs_data
has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring. Open
def compile_jobs_data(self, videoid, task_type, nfo_settings=None):
"""Compile a list of jobs data based on the videoid"""
LOG.debug('Compiling list of jobs data for task handler "{}" and videoid "{}"',
task_type.__name__, videoid)
jobs_data = None
- 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 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)
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':
- 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 _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()
- 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 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
- 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_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"