Showing 227 of 283 total issues
Avoid deeply nested control flow statements. Open
for size in sizes:
if size.get("type") == key:
body += "Photo: %s" % size.get("url") # No new line needed if we have just one photo and no text
found = True
break
Function publishInstance
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def publishInstance():
"""
That's such a weird function just makes a post request
to the vk4xmpp monitor which is located on http://xmppserv.ru/xmpp-monitor
You can check out the source of The VK4XMPP Monitor utilty
- 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
Avoid deeply nested control flow statements. Open
if current.get("attachments"):
body += spacer + parseAttachments(self, current, spacer)[1] + "\n" + spacer + "\n"
body += spacer + ("Wall: %s" % WALL_LINK % current)
Function connect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def connect(self, dupe=None):
"""
Starts connection. Connects to proxy, supplies login and password to it
(if were specified while creating instance). Instructs proxy to make
connection to the target server. Returns non-empty sting on success.
- 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 RegisterNamespaceHandler
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def RegisterNamespaceHandler(self, xmlns, handler, typ="", ns="", makefirst=0, system=0):
Avoid deeply nested control flow statements. Open
if isdef("ENABLE_RGB_CONVERSION") and ENABLE_RGB_CONVERSION:
data = convertImage(data)
mime = "jpeg"
data = base64.b64encode(data)
Function init
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def init(self, owner, id, jid, subject, date, users=[]):
Avoid deeply nested control flow statements. Open
if found:
break
Avoid deeply nested control flow statements. Open
for image in images:
if image.get("width") == size or image.get("height") == size:
body += "Sticker: %s" % image["url"]
found = True
break
Function handleMessage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handleMessage(self, user, vkChat, retry=True):
"""
Handle incoming (VK -> XMPP) messages
"""
if self.created:
- 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 _discover
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _discover(disp, ns, jid, node=None, fb2b=0, fb2a=1):
Avoid deeply nested control flow statements. Open
for each in stanza.getChildren():
self.dispatch(each, session, direct=1)
return None
Avoid deeply nested control flow statements. Open
if not getattr(user, "last_status", None) or user.last_status != status:
if mask & 1024 == 1024:
if not status:
user.vk.method("status.set", {"text": ""})
else:
Avoid deeply nested control flow statements. Open
if current.get("text") or current.get("copy_text"):
body += spacer + uhtml(compile_eol.sub("\n" + spacer, current["text"] or current.get("copy_text"))) + "\n"
if current.get("attachments"):
Function asDict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def asDict(self):
"""
Represent dataitem as simple dictionary mapping of datafield names to their values.
"""
ret = {}
- 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name=None, value=None, typ=None, required=0, label=None, desc=None, options=[], node=None):
"""
Create new data field of specified name,value and type. Also "required", "desc" and "options" fields can be set.
Alternatively other XML object can be passed in as the "node" parameted to replicate it as a new datafiled.
"""
- 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
Avoid deeply nested control flow statements. Open
if retry:
utils.runThread(statustovk_prs01, (source, prs, (retry -1)), delay=10)
Avoid deeply nested control flow statements. Open
if tid > 0:
name = "%s's" % name_
else:
name = "“%s”" % name_
Avoid deeply nested control flow statements. Open
if x == "'":
text += Nocolor
break
elif c.isdigit():
Function ReceiveHandler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ReceiveHandler(self, conn, stanza):
"""
Receive next portion of incoming datastream and store it write
it to temporary file. Used internally.
"""
- 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"