Skip to content

Commit 03a7666

Browse files
committed
Code quality
1 parent 9bdae27 commit 03a7666

7 files changed

Lines changed: 26 additions & 17 deletions

File tree

setup.cfg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ ignore = bitmessagekivy
2424
[pylint.messages_control]
2525
disable =
2626
invalid-name,bare-except,broad-except,relative-import,
27-
superfluous-parens,bad-option-value,fixme
27+
superfluous-parens,bad-option-value,fixme,missing-docstring,
28+
too-many-locals
2829
# invalid-name: needs fixing during a large, project-wide refactor
2930
# bare-except,broad-except: Need fixing once thorough testing is easier
3031
# bad-option-value is for backward compatibility between python 2 and 3
@@ -42,7 +43,8 @@ ignore = bitmessagekivy
4243
[MESSAGES CONTROL]
4344
disable =
4445
invalid-name,bare-except,broad-except,relative-import,
45-
superfluous-parens,bad-option-value,fixme
46+
superfluous-parens,bad-option-value,fixme,missing-docstring,
47+
too-many-locals
4648

4749
[DESIGN]
4850
max-args = 8

src/bitmessagecli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ def apiInit(apiEnabled):
188188
def apiData():
189189
"""TBC"""
190190

191-
global keysName
192191
global keysPath
193192
global usrPrompt
194193

src/bitmessageqt/__init__.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
PyQt based UI for bitmessage, the main module
33
"""
44
# pylint: disable=import-error,too-many-lines,no-member
5+
# pylint: disable=too-many-branches
56
import hashlib
67
import locale
78
import os
@@ -760,6 +761,11 @@ def __init__(self, parent=None):
760761

761762
self.unreadCount = 0
762763

764+
self.currentTrayIconFileName = ""
765+
self.actionQuiet = None
766+
self.actionShow = None
767+
self.tray = None
768+
763769
# Set the icon sizes for the identicons
764770
identicon_size = 3 * 7
765771
self.ui.tableWidgetInbox.setIconSize(QtCore.QSize(identicon_size, identicon_size))
@@ -3978,12 +3984,12 @@ def on_context_menuInbox(self, point):
39783984
popMenuInbox.addAction(self.actionReply)
39793985
popMenuInbox.addAction(self.actionAddSenderToAddressBook)
39803986
# pylint: disable=no-member
3981-
self.actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction(
3987+
actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction(
39823988
_translate("MainWindow", "Copy subject to clipboard")
39833989
if tableWidget.currentColumn() == 2 else
39843990
_translate("MainWindow", "Copy address to clipboard"),
39853991
self.on_action_ClipboardMessagelist)
3986-
popMenuInbox.addAction(self.actionClipboardMessagelist)
3992+
popMenuInbox.addAction(actionClipboardMessagelist)
39873993
# pylint: disable=no-member
39883994
self._contact_selected = tableWidget.item(currentRow, 1)
39893995
# preloaded gui.menu plugins with prefix 'address'
@@ -4229,7 +4235,7 @@ class BitmessageQtApplication(QtGui.QApplication):
42294235
"""
42304236

42314237
# Unique identifier for this application
4232-
uuid = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c'
4238+
UUID = '6ec0149b-96e1-4be1-93ab-1465fb3ebf7c'
42334239

42344240
@staticmethod
42354241
def get_windowstyle():
@@ -4241,7 +4247,6 @@ def get_windowstyle():
42414247

42424248
def __init__(self, *argv):
42434249
super(BitmessageQtApplication, self).__init__(*argv)
4244-
id = BitmessageQtApplication.uuid
42454250

42464251
QtCore.QCoreApplication.setOrganizationName("PyBitmessage")
42474252
QtCore.QCoreApplication.setOrganizationDomain("bitmessage.org")
@@ -4259,14 +4264,14 @@ def __init__(self, *argv):
42594264
self.is_running = False
42604265

42614266
socket = QLocalSocket()
4262-
socket.connectToServer(id)
4267+
socket.connectToServer(self.UUID)
42634268
self.is_running = socket.waitForConnected()
42644269

42654270
# Cleanup past crashed servers
42664271
if not self.is_running:
42674272
if socket.error() == QLocalSocket.ConnectionRefusedError:
42684273
socket.disconnectFromServer()
4269-
QLocalServer.removeServer(id)
4274+
QLocalServer.removeServer(self.UUID)
42704275

42714276
socket.abort()
42724277

@@ -4278,7 +4283,7 @@ def __init__(self, *argv):
42784283
# Nope, create a local server with this id and assign on_new_connection
42794284
# for whenever a second instance tries to run focus the application.
42804285
self.server = QLocalServer()
4281-
self.server.listen(id)
4286+
self.server.listen(self.UUID)
42824287
self.server.newConnection.connect(self.on_new_connection)
42834288

42844289
self.setStyleSheet("QStatusBar::item { border: 0px solid black }")
@@ -4293,20 +4298,20 @@ def on_new_connection(self):
42934298

42944299

42954300
def init():
4296-
global app
4301+
global app # pylint: disable=global-statement
42974302
if not app:
42984303
app = BitmessageQtApplication(sys.argv)
42994304
return app
43004305

43014306

43024307
def run():
4303-
global myapp
4304-
app = init()
4305-
myapp = MyForm()
4308+
global myapp # pylint: disable=global-statement
4309+
_app = init()
4310+
myapp = MyForm() # pylint: disable=redefined-outer-name
43064311

43074312
myapp.appIndicatorInit(app)
43084313

4309-
if myapp._firstrun:
4314+
if myapp._firstrun: # pylint: disable=protected-access
43104315
myapp.showConnectDialog() # ask the user if we may connect
43114316

43124317
# only show after wizards and connect dialogs have completed
@@ -4315,4 +4320,4 @@ def run():
43154320
QtCore.QTimer.singleShot(
43164321
30000, lambda: myapp.setStatusIcon(state.statusIconColor))
43174322

4318-
app.exec_()
4323+
_app.exec_()

src/bitmessageqt/account.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def accountClass(address):
6868
if subscription.type != AccountMixin.BROADCAST:
6969
return None
7070
else:
71+
# pylint: disable=redefined-variable-type
7172
subscription = SubscriptionAccount(address)
7273
if subscription.type != AccountMixin.SUBSCRIPTION:
7374
# e.g. deleted chan

src/bitmessageqt/bitmessage_icons_rc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#
88
# WARNING! All changes made in this file will be lost!
99

10+
# pylint: disble=too-many-lines
1011
from PyQt4 import QtCore # pylint: disable=import-error
1112

1213
qt_resource_data = "\

src/bitmessageqt/uisignaler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def get(cls):
1717
cls._instance = UISignaler()
1818
return cls._instance
1919

20+
# pylint: disable=too-many-branches
2021
def run(self):
2122
while True:
2223
command, data = queues.UISignalQueue.get()

src/class_sqlThread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,5 +643,5 @@ def create_function(self):
643643
self.conn.create_function("enaddr", 3, func=encodeAddress, deterministic=True)
644644
except (TypeError, sqlite3.NotSupportedError) as err:
645645
logger.debug(
646-
"Got error while pass deterministic in sqlite create function {}, Passing 3 params".format(err))
646+
"Got error while pass deterministic in sqlite create function %s, Passing 3 params", err)
647647
self.conn.create_function("enaddr", 3, encodeAddress)

0 commit comments

Comments
 (0)