pylint: Enable useless-suppression globally.

We deactivate it locally where needed, i.e. where we are sure it's some
platform-specific thing.
This commit is contained in:
Florian Bruhin 2015-12-01 23:01:09 +01:00
parent cf54fa1ef1
commit eff0e4c7cc
10 changed files with 21 additions and 14 deletions

View File

@ -9,6 +9,7 @@ load-plugins=pylint_checkers.config,
pylint_checkers.settrace
[MESSAGES CONTROL]
enable=all
disable=no-self-use,
fixme,
global-statement,
@ -30,7 +31,8 @@ disable=no-self-use,
wrong-import-order,
ungrouped-imports,
wrong-import-position,
redefined-variable-type
redefined-variable-type,
suppressed-message
[BASIC]
function-rgx=[a-z_][a-z0-9_]{2,50}$

View File

@ -57,7 +57,8 @@ class SslError(QSslError):
def __hash__(self):
try:
# Qt >= 5.4
return super().__hash__() # pylint: disable=not-callable
# pylint: disable=not-callable,useless-suppression
return super().__hash__()
except TypeError:
return hash((self.certificate().toDer(), self.error()))

View File

@ -44,8 +44,8 @@ class _QtFIFOReader(QObject):
# See http://www.outflux.net/blog/archives/2008/03/09/using-select-on-a-fifo/
# We also use os.open and os.fdopen rather than built-in open so we
# can add O_NONBLOCK.
fd = os.open(filepath, os.O_RDWR |
os.O_NONBLOCK) # pylint: disable=no-member
# pylint: disable=no-member,useless-suppression
fd = os.open(filepath, os.O_RDWR | os.O_NONBLOCK)
self.fifo = os.fdopen(fd, 'r')
self._notifier = QSocketNotifier(fd, QSocketNotifier.Read, self)
self._notifier.activated.connect(self.read_line)
@ -175,7 +175,8 @@ class _POSIXUserscriptRunner(_BaseUserscriptRunner):
# exist, it shouldn't be a big issue.
self._filepath = tempfile.mktemp(prefix='qutebrowser-userscript-',
dir=standarddir.runtime())
os.mkfifo(self._filepath) # pylint: disable=no-member
# pylint: disable=no-member,useless-suppression
os.mkfifo(self._filepath)
except OSError as e:
message.error(self._win_id, "Error while creating FIFO: {}".format(
e))

View File

@ -308,7 +308,7 @@ class SignalHandler(QObject):
signal.SIGTERM, self.interrupt)
if os.name == 'posix' and hasattr(signal, 'set_wakeup_fd'):
# pylint: disable=import-error,no-member
# pylint: disable=import-error,no-member,useless-suppression
import fcntl
read_fd, write_fd = os.pipe()
for fd in (read_fd, write_fd):

View File

@ -123,7 +123,8 @@ def init_faulthandler(fileobj=sys.__stderr__):
faulthandler.enable(fileobj)
if hasattr(faulthandler, 'register') and hasattr(signal, 'SIGUSR1'):
# If available, we also want a traceback on SIGUSR1.
faulthandler.register(signal.SIGUSR1) # pylint: disable=no-member
# pylint: disable=no-member,useless-suppression
faulthandler.register(signal.SIGUSR1)
def fix_harfbuzz(args):

View File

@ -259,7 +259,7 @@ def qt_message_handler(msg_type, context, msg):
QtCore.QtFatalMsg: logging.CRITICAL,
}
try:
# pylint: disable=no-member
# pylint: disable=no-member,useless-suppression
qt_to_logging[QtCore.QtInfoMsg] = logging.INFO
except AttributeError:
# Qt < 5.5

View File

@ -29,7 +29,7 @@ import os.path
import sys
import distutils
import cx_Freeze as cx # pylint: disable=import-error
import cx_Freeze as cx # pylint: disable=import-error,useless-suppression
# cx_Freeze is hard to install (needs C extensions) so we don't check for it.
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,

View File

@ -26,7 +26,7 @@ import os.path
import sys
import contextlib
import cx_Freeze as cx # pylint: disable=import-error
import cx_Freeze as cx # pylint: disable=import-error,useless-suppression
# cx_Freeze is hard to install (needs C extensions) so we don't check for it.
import pytest

View File

@ -316,7 +316,7 @@ class TestListen:
@pytest.mark.posix
def test_permissions_posix(self, ipc_server):
# pylint: disable=no-member
# pylint: disable=no-member,useless-suppression
ipc_server.listen()
sockfile = ipc_server._server.fullServerName()
sockdir = os.path.dirname(sockfile)

View File

@ -25,7 +25,8 @@ import sys
import operator
import os.path
try:
from test import test_file # pylint: disable=no-name-in-module
# pylint: disable=no-name-in-module,useless-suppression
from test import test_file
except ImportError:
# Debian patches Python to remove the tests...
test_file = None
@ -748,10 +749,11 @@ class TestPyQIODevice:
def test_seek_unsupported(self, pyqiodev):
"""Test seeking with unsupported whence arguments."""
# pylint: disable=no-member,useless-suppression
if hasattr(os, 'SEEK_HOLE'):
whence = os.SEEK_HOLE # pylint: disable=no-member
whence = os.SEEK_HOLE
elif hasattr(os, 'SEEK_DATA'):
whence = os.SEEK_DATA # pylint: disable=no-member
whence = os.SEEK_DATA
else:
pytest.skip("Needs os.SEEK_HOLE or os.SEEK_DATA available.")
pyqiodev.open(QIODevice.ReadOnly)