Showing 154 of 154 total issues
Avoid deeply nested control flow statements. Open
Open
if len(word) == 2:
oper = word[-2:]
try:
word = msgdetail["replyto"].lower()
except:
Avoid deeply nested control flow statements. Open
Open
if result['ok'] is True or result['ok'] == 'True':
text = _("User %s unbanned out of chat %s") % (user_id, chat_id)
else:
text = _("Error unbanning user %s from chat %s: %s") % (user_id, chat_id, result['description'])
stampy.stampy.sendmessage(chat_id=chat_id, text=text, reply_to_message_id=message_id, disable_web_page_preview=True, parse_mode="Markdown")
Avoid deeply nested control flow statements. Open
Open
if token:
chanlinkslave(message=message, token=token)
except:
Avoid deeply nested control flow statements. Open
Open
if url and 'USA-' in title:
url = url = "https://us-redhat.icims.com/jobs/%s/job?iis=A+Red+Hat+Employee&iispid=21098" % jobid
Avoid deeply nested control flow statements. Open
Open
if gid > 0: # user private chat
validkeys = ['language', 'currency', 'modulo',
'stock', 'espp', 'cleanlink', 'cleankey']
elif gid < 0: # group chat or channel
validkeys = ['language', 'currency', 'modulo',
Avoid deeply nested control flow statements. Open
Open
if key == 'gid':
value = texto.split('=')[1:][0].lower()
text = _("Setting gid for sudo to `%s`") % value
stampy.stampy.sendmessage(chat_id=chat_id, text=text,
reply_to_message_id=message_id,
Avoid deeply nested control flow statements. Open
Open
if command == trigger[1:]:
runplugin = True
break
elif trigger in texto:
Avoid deeply nested control flow statements. Open
Open
if result['ok'] is True or result['ok'] == 'True':
text = _("Users opped on chat %s") % chat_id
else:
text = _("Error opping users from chat %s: %s") % (chat_id, result)
Avoid deeply nested control flow statements. Open
Open
if result['ok'] is True or result['ok'] == 'True':
text = _("User %s oped on chat %s") % (user_id, chat_id)
else:
text = _("Error oping user %s from chat %s: %s") % (user_id, chat_id, result)
Avoid deeply nested control flow statements. Open
Open
if newurl != url:
delete = True
# Check if url has to be cleaned
if cleankey:
Avoid deeply nested control flow statements. Open
Open
for item in word:
if stampy.plugin.alias.getalias(item, gid=gid):
item = stampy.plugin.alias.getalias(item, gid=gid)
if oper == "++" and item not in wordadd:
wordadd.append(item)
Avoid deeply nested control flow statements. Open
Open
if stampy.plugin.config.config(key='sudo'):
# "=" was not in first command, so consider a command to use as 'sudo'
# It is a new list, with unique message, so we can alter it
stampy.plugin.config.setconfig(key='overridegid', gid=0, value=message['message']['chat']['id'])
Avoid deeply nested control flow statements. Open
Open
if "@" in each:
username = each[1:-1]
if username and username != "@":
Avoid deeply nested control flow statements. Open
Open
if result['ok'] is True or result['ok'] == 'True':
text = _("User %s unmuted on chat %s") % (user_id, chat_id)
else:
text = _("Error unmuting %s from chat %s: %s") % (
user_id, chat_id, result)
Avoid deeply nested control flow statements. Open
Open
if result['ok'] is True or result['ok'] == 'True':
text = _("User %s information: %s") % (user_id, result['result'])
else:
text = _("Error querying user %s information: %s") % (user_id, result)
Function sendmessage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def sendmessage(chat_id=0, text="", reply_to_message_id=False,
Avoid deeply nested control flow statements. Open
Open
if result['ok'] is True or result['ok'] == 'True':
text = _("User %s deoped on chat %s") % (user_id, chat_id)
else:
text = _("Error deoping %s from chat %s: %s") % (user_id, chat_id, result)
Function stock
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def stock(message):
"""
Processes stock commands
:param message: Message with the command
:return:
- 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
Open
if cleankey:
renewurl = re.sub(cleankey, '', newurl)
if renewurl != newurl:
delete = True
Function sendimage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def sendimage(chat_id=0, image="", text="", reply_to_message_id=""):
"""
Sends an image to chat_id as a reply to a message received
:param chat_id: ID of the chat
:param image: image URI
- 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"