Code Quality

This commit is contained in:
anand k 2024-02-23 23:50:04 +05:30
parent d545630ac7
commit b43c9c4a75
4 changed files with 11 additions and 12 deletions

View File

@ -1370,7 +1370,9 @@ class singleWorker(StoppableThread):
'bitmessagesettings', 'apinotifypath')
if apiNotifyPath:
call([apiNotifyPath, "newMessage"])
# There is no additional risk of remote exploitation or
# privilege escalation
call([apiNotifyPath, "newMessage"]) # nosec:B603
def requestPubKey(self, toAddress):
"""Send a getpubkey object"""

View File

@ -22,11 +22,8 @@ class smtpDeliver(StoppableThread):
_instance = None
def stopThread(self):
# pylint: disable=no-member
try:
queues.UISignallerQueue.put(("stopThread", "data"))
except: # noqa:E722
pass
"""Relay shutdown instruction"""
queues.UISignalQueue.put(("stopThread", "data"))
super(smtpDeliver, self).stopThread()
@classmethod

View File

@ -287,7 +287,7 @@ def check_openssl():
path = ctypes.util.find_library('ssl')
if path not in paths:
paths.append(path)
except: # noqa:E722
except: # nosec:B110 pylint:disable=bare-except
pass
openssl_version = None

View File

@ -45,7 +45,7 @@ def sqlQuery(sql_statement, *args):
:param list args: SQL query parameters
:rtype: list
"""
assert sql_available
assert sql_available # nosec:B101
sql_lock.acquire()
sqlSubmitQueue.put(sql_statement)
@ -65,7 +65,7 @@ def sqlExecuteChunked(sql_statement, idCount, *args):
"""Execute chunked SQL statement to avoid argument limit"""
# SQLITE_MAX_VARIABLE_NUMBER,
# unfortunately getting/setting isn't exposed to python
assert sql_available
assert sql_available # nosec:B101
sqlExecuteChunked.chunkSize = 999
if idCount == 0 or idCount > len(args):
@ -95,7 +95,7 @@ def sqlExecuteChunked(sql_statement, idCount, *args):
def sqlExecute(sql_statement, *args):
"""Execute SQL statement (optionally with arguments)"""
assert sql_available
assert sql_available # nosec:B101
sql_lock.acquire()
sqlSubmitQueue.put(sql_statement)
@ -120,7 +120,7 @@ def sqlExecuteScript(sql_statement):
def sqlStoredProcedure(procName):
"""Schedule procName to be run"""
assert sql_available
assert sql_available # nosec:B101
sql_lock.acquire()
sqlSubmitQueue.put(procName)
if procName == "exit":
@ -143,7 +143,7 @@ class SqlBulkExecute(object):
@staticmethod
def execute(sql_statement, *args):
"""Used for statements that do not return results."""
assert sql_available
assert sql_available # nosec:B101
sqlSubmitQueue.put(sql_statement)
if args == ():