File __init__.py
has 4500 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
PLUGIN_VERSION = "3.0.1"
SUPPORTED_DVBVIEWER_VERSIONS = '4.9.x (older versions might work but are untested)'
Function Update
has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring. Open
def Update( self, updateMode=UPDATE_TIMERS ) :
def GetID( *args ) :
m = hashlib.md5()
- 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 run
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
def run(self) :
if self.watchDogTime == 0 :
return False
plugin = self.plugin
- 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 Configure
has 194 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Configure( self,
useSendMessage=False,
oldInterface=False,
newInterface=True,
startDVBViewerByCOM=False,
Function Configure
has 181 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Configure( self,
deleteQueryTpl=None
) :
def UpdateQueryFromGuiSettings(q):
q.deleteByName, q.titleName = q.checkStringArg(deleteByNameCB.GetValue(), titleNameComboCtrl.GetValue())
Function __call__
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def __call__( self,
allRecordings=False,
enableDVBViewer=True,
enableDVBService=True,
updateDVBService=False,
- 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 __call__
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def __call__( self, enableDVBViewer=True, enableDVBService=False, updateDVBService=False ) :
plugin = self.plugin
leadTime = plugin.schedulerLeadTime * 60.0
- 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 Connect
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def Connect( self, connectingMode=WAIT_CHECK_START_CONNECT, lock=False ):
'''
This is one of the key methods of the plugin. The method has three modes:
# WAIT_CHECK_START_CONNECT = 0 # check if executing, start if not executing, connect
# CONNECT = 1 # connect to a running DVBViewer instance (only to be used by the watchdog thread)
- 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
Cyclomatic complexity is too high in method run. (40) Open
@eg.LogItWithReturn
def run(self) :
if self.watchDogTime == 0 :
- Read upRead up
- Exclude checks
Cyclomatic Complexity
Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.
Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:
Construct | Effect on CC | Reasoning |
---|---|---|
if | +1 | An if statement is a single decision. |
elif | +1 | The elif statement adds another decision. |
else | +0 | The else statement does not cause a new decision. The decision is at the if. |
for | +1 | There is a decision at the start of the loop. |
while | +1 | There is a decision at the while statement. |
except | +1 | Each except branch adds a new conditional path of execution. |
finally | +0 | The finally block is unconditionally executed. |
with | +1 | The with statement roughly corresponds to a try/except block (see PEP 343 for details). |
assert | +1 | The assert statement internally roughly equals a conditional statement. |
Comprehension | +1 | A list/set/dict comprehension of generator expression is equivalent to a for loop. |
Boolean Operator | +1 | Every boolean operator (and, or) adds a decision point. |
Function __call__
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def __call__( self,
enableDVBViewer=True,
enableDVBService=True,
updateDVBService=False
) :
- 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 __call__
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def __call__( self,
allRecordings=False,
enableDVBViewer=True,
enableDVBService=False,
updateDVBService=False
- 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 UpdateDVTimers
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def UpdateDVTimers( self, lock=True, updateService=False ) :
timerIDs = []
completeTimerInfo = []
- 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 Configure
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def Configure( self,
channelID = "",
date = "", # dd.mm.yyyy
startTime = "", # hh:mm
endTime = "", # hh:mm
- 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 __init__
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self):
self.AddEvents(*EVENT_LIST)
group = self.AddGroup("DVBViewer program actions", "DVBViewer program management")
group.AddAction(Start)
Cyclomatic complexity is too high in method ComputeQueryResult. (32) Open
# computes the query result
# This code was hard to write, so it's OK if it's hard to read :)
def ComputeQueryResult(self, recordings, deleteQuery, silent=False):
emptyResult = (0, [])
if recordings is None or len(recordings) == 0:
- Read upRead up
- Exclude checks
Cyclomatic Complexity
Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.
Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:
Construct | Effect on CC | Reasoning |
---|---|---|
if | +1 | An if statement is a single decision. |
elif | +1 | The elif statement adds another decision. |
else | +0 | The else statement does not cause a new decision. The decision is at the if. |
for | +1 | There is a decision at the start of the loop. |
while | +1 | There is a decision at the while statement. |
except | +1 | Each except branch adds a new conditional path of execution. |
finally | +0 | The finally block is unconditionally executed. |
with | +1 | The with statement roughly corresponds to a try/except block (see PEP 343 for details). |
assert | +1 | The assert statement internally roughly equals a conditional statement. |
Comprehension | +1 | A list/set/dict comprehension of generator expression is equivalent to a for loop. |
Boolean Operator | +1 | Every boolean operator (and, or) adds a decision point. |
Function __call__
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def __call__( self,
deleteQueryTpl=None
) :
def printRecord(rec, prefix=''):
delim = ' | '
- 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 Configure
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Configure( self,
channelID = "",
date = "", # dd.mm.yyyy
startTime = "", # hh:mm
endTime = "", # hh:mm
Function Configure
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Configure( self,
allChannels=False, # returns a list of all channels
currentChannel=True, # returns just the current channel
channelID="", # 32bit or 64bit channelID (see WIKI for description)
fromVariable=False, # get channelID from a variable
Function ComputeQueryResult
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def ComputeQueryResult(self, recordings, deleteQuery, silent=False):
emptyResult = (0, [])
if recordings is None or len(recordings) == 0:
return emptyResult
- 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 Configure
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def Configure( self,
useSendMessage=False,
oldInterface=False,
newInterface=True,
startDVBViewerByCOM=False,
- 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 run
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def run(self) :
plugin = self.plugin
plugin.lockedByTerminate |= plugin.executionStatusChangeLock.acquire( blocking=False, timeout=TERMINATE_TIMEOUT )
- 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 __start__
has 22 arguments (exceeds 4 allowed). Consider refactoring. Open
def __start__( self,
Function Configure
has 22 arguments (exceeds 4 allowed). Consider refactoring. Open
def Configure( self,
Function OnPlaystatechange
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def OnPlaystatechange(self, RendererType, State):
plugin = self.plugin
plugin.eventHandlingIsAlive = True
if plugin.oldInterface :
self.TriggerEvent( "Playstatechange:RenderTy" + str(RendererType) + "State"+ str(State) )
- 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 Configure
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Configure( self,
channelID = "", # 32bit or 64bit channelID (see WIKI for description)
fromVariable = False, # get channelID from a variable
variableName = "eg.result" # for example "eg.result"
) :
DVBViewerWorkerThread
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class DVBViewerWorkerThread(eg.ThreadWorker):
"""
This thread connects to DVBViewer's COM interface and performs all tasks related to this.
It is started by the plugin.Connect() method which is called from the watchdog thread
as soon as a running dvbviewer.exe instance is detected.
Function Configure
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def Configure( self,
deleteQueryTpl=None
) :
def UpdateQueryFromGuiSettings(q):
q.deleteByName, q.titleName = q.checkStringArg(deleteByNameCB.GetValue(), titleNameComboCtrl.GetValue())
- 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
DVBViewer
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class DVBViewer(eg.PluginClass):
'''
The DVBViewer plugin main class. Responsible for configuration, setup and runstate management of the plugin.
One of the central points in the plugin class is 'Connect()' - see there
A few other "hot spots" in the plugin:
Function __call__
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__(self,
Function AddTimer
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
def AddTimer( self,
Function GetData
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def GetData( self, interface, params=None ) :
def ErrorProcessing( e ) :
self.failing = True
if hasattr(e, 'code') and e.code == 401 :
- 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 Configure
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
def Configure( self,
Function Configure
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def Configure( self,
allChannels=False, # returns a list of all channels
currentChannel=True, # returns just the current channel
channelID="", # 32bit or 64bit channelID (see WIKI for description)
fromVariable=False, # get channelID from a variable
- 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
Cyclomatic complexity is too high in method UpdateDVTimers. (22) Open
@eg.LogIt
def UpdateDVTimers( self, lock=True, updateService=False ) :
- Read upRead up
- Exclude checks
Cyclomatic Complexity
Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.
Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:
Construct | Effect on CC | Reasoning |
---|---|---|
if | +1 | An if statement is a single decision. |
elif | +1 | The elif statement adds another decision. |
else | +0 | The else statement does not cause a new decision. The decision is at the if. |
for | +1 | There is a decision at the start of the loop. |
while | +1 | There is a decision at the while statement. |
except | +1 | Each except branch adds a new conditional path of execution. |
finally | +0 | The finally block is unconditionally executed. |
with | +1 | The with statement roughly corresponds to a try/except block (see PEP 343 for details). |
assert | +1 | The assert statement internally roughly equals a conditional statement. |
Comprehension | +1 | A list/set/dict comprehension of generator expression is equivalent to a for loop. |
Boolean Operator | +1 | Every boolean operator (and, or) adds a decision point. |
Function GetChannelLists
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def GetChannelLists( self, lock=True ) :
def GetChannelList( rawlist, isTV, channelIDbyIDList, IDbychannelIDList, channelList ) :
for ix in xrange( len(rawlist) ) :
nr = ( ix, isTV )
- 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 __call__
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def __call__( self, active = True, enableDVBViewer = True, enableDVBService = False, updateDVBService = False ) :
plugin = self.plugin
idList = []
- 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 Configure
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def Configure( self,
channelID = "", # 32bit or 64bit channelID (see WIKI for description)
fromVariable = False, # get channelID from a variable
variableName = "eg.result" # for example "eg.result"
) :
- 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 toTimerEntry
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
def toTimerEntry(timerID, channelID, channelName, dateStr, startTimeStr, endTimeStr, startDateTime, endDateTime,
Function __init__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function IfMustInList
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def IfMustInList( self, now, record, active, recordingsIDsService ) :
"""
Returns True if timer is NOT in RS timer list and timer has not ended yet.
"""
if record[ TI_4_ID ] not in recordingsIDsService :
- 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 __stop__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __stop__(self):
# If watchDogThread has been paused, resume it again
if self.watchDogThread is not None:
self.watchDogThread.pauseEvent.set()
- 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 UpdateDisplayMode
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def UpdateDisplayMode( self ) :
windowID = self.actualWindowID
if windowID in DVBVIEWER_WINDOWS :
self.actualDisplayMode = DVBVIEWER_WINDOWS[ windowID ]
elif windowID != -1 and windowID != 500 :
- 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 QueryAsText
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def QueryAsText(self):
text = DeleteRecordings.Text
label = ''
if self.dryMode:
- 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 __call__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__(self,
Function __call__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self,
allChannels=False, # returns a list of all channels
currentChannel=False, # returns just the current channel
channelID=None, # 32bit or 64bit channelID
fromVariable=False, # get channelID from a variable
- 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 toRecordingEntry
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def toRecordingEntry(recID, channel, startDate, description, duration, filename, played, title, series, fromRS):
Function Configure
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def Configure( self,
Function IsDVBViewerProcessRunning
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def IsDVBViewerProcessRunning(self, WMI=None, eventOnException=True):
'''Checks if the dvbviewer.exe process is running'''
wmiCreated = WMI is None
if wmiCreated:
try:
- 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 __start__
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __start__( self,
useSendMessage=False,
oldInterface=True,
newInterface=False,
startDVBViewerByCOM=False,
Function run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run( self ) :
plugin = self.plugin
abort = False
saveDisableAV = plugin.disableAV
- 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 Configure
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def Configure( self,
Function CheckGetDVBViewerPath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def CheckGetDVBViewerPath(self, pathDVBViewer) :
if pathDVBViewer is None:
pathDVBViewer = ''
else:
pathDVBViewer = unicode(pathDVBViewer).strip()
- 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 HandlePasswordFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def HandlePasswordFile( self, write=False, accounts=[('','')] ) :
passwordFileName = os.path.join(eg.folderPath.RoamingAppData, eg.APP_NAME, 'DVBViewerAccount.dat')
crypt = self.Crypt
- 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 Configure
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def Configure( self,
Function __call__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__(self,
Avoid deeply nested control flow statements. Open
while ( timeCount > 0 and not self.abort ) :
sleep( 0.5 )
timeCount -= 1
#print "wait"
Function ServiceConfigure
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def ServiceConfigure( self, enableDVBViewer=True, enableDVBService=False, updateDVBService=False, affirmed=True, panel=None ) :
Function GetLabel
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def GetLabel(self, allChannels, currentChannel, channelID, fromVariable, variableName, *dummyArgs):
Function LoadRecordingsData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def LoadRecordingsData(self, deleteQueryTpl):
if deleteQueryTpl is None:
query = self.DeleteQuery() # new query with defaults
else:
query = self.DeleteQuery.FromTupel(deleteQueryTpl) # convert tupel into DeleteQuery object
- 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 __call__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__( self,
Avoid deeply nested control flow statements. Open
if res == 0 :
eg.PrintError( "DVBViewer couldn't started" )
return False
self.DVBViewerStartedByCOM = False
Consider simplifying this complex logical expression. Open
if rsList is not None and len(rsList) > 0 and dvbvList is not None and len(dvbvList) > 0:
# copy the 'played' attribute from DVBViewer into the list from RS
for rsKey, rsVal in rsList.items():
retVal = cpy(rsVal) # deep copy
dvbvVal = dvbvList.get(rsKey, None)
Consider simplifying this complex logical expression. Open
if allChannels and currentChannel or allChannels and fromVariable or currentChannel and fromVariable:
eg.PrintError("Illegal argument combination: Just one of the arguments 'allChannels', 'currentChannel' and 'fromVariable' must be True.")
return None
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__( self, plugin, name, timeoutFunc=None, timeout=CALLWAIT_TIMEOUT-10, severeErrorEventOnTimeout=True) :
Function GetChannelList
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def GetChannelList( rawlist, isTV, channelIDbyIDList, IDbychannelIDList, channelList ) :
Function GetChannelDetails
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def GetChannelDetails(self, allChannels, currentChannel, channelID):
result = None
if allChannels:
result = cpy(self.plugin.channelDetailsList) # return a deep copy, not the original
channelID = 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 printCaller
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def printCaller(self, prefix, blocking=None):
'''Debug helper function. Prints the calling classname, method and code line for
acquire and release locks. Helpful in order to find dead locks.'''
if False: #eg.debugLevel > 0: # TODO
try:
- 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 ServiceConfigure
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ServiceConfigure( self, enableDVBViewer=True, enableDVBService=False, updateDVBService=False, affirmed=True, panel=None ) :
def onCheckBox( event ) :
viewer = viewerCheckBoxCtrl.GetValue()
service = serviceCheckBoxCtrl.GetValue()
- 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 ProcessMediaplayback
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ProcessMediaplayback( self ) :
plugin = self.plugin
last = plugin.playBackMode
playBackIsStarted = self.dvbviewer.isMediaplayback()
isDVD = self.dvbviewer.isDVD()
- 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
TODO found Open
if False: #eg.debugLevel > 0: # TODO
- Exclude checks
FIXME found Open
#CoInitialize() # FIXME - I cannot imagine why CoInitialize should be needed here
- Exclude checks
TODO found Open
# TODO: re-implement using action 'GetTimerDetails' (simplifies a lot)
- Exclude checks