diff --git a/.pylintrc b/.pylintrc
index 79fb9f860..984b56b27 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -26,7 +26,11 @@ disable=no-self-use,
blacklisted-name,
too-many-lines,
logging-format-interpolation,
- interface-not-implemented
+ interface-not-implemented,
+ broad-except,
+ bare-except,
+ eval-used,
+ exec-used
[BASIC]
module-rgx=(__)?[a-z][a-z0-9_]*(__)?$
diff --git a/.run_checks b/.run_checks
index 808d5882f..6f60d98b9 100644
--- a/.run_checks
+++ b/.run_checks
@@ -14,7 +14,7 @@ exclude=test_.*
args=--output-format=colorized,--reports=no,--rcfile=.pylintrc
plugins=config,crlf,modeline,settrace,openencoding
# excluding command.py is a WORKAROUND for https://bitbucket.org/logilab/pylint/issue/395/horrible-performance-related-to-inspect
-exclude=resources.py,command.py
+exclude=resources.py
[flake8]
args=--config=.flake8
diff --git a/qutebrowser/app.py b/qutebrowser/app.py
index a8fe9f8a9..829aee94c 100644
--- a/qutebrowser/app.py
+++ b/qutebrowser/app.py
@@ -487,7 +487,7 @@ class Application(QApplication):
QUrl.RemovePassword | QUrl.FullyEncoded)
if urlstr:
win_pages.append(urlstr)
- except Exception: # pylint: disable=broad-except
+ except Exception:
if forgiving:
log.destroy.exception("Error while recovering tab")
else:
@@ -538,8 +538,6 @@ class Application(QApplication):
It'll try very hard to write all open tabs to a file, and then exit
gracefully.
"""
- # pylint: disable=broad-except
-
exc = (exctype, excvalue, tb)
if not self._quit_status['crash']:
@@ -682,9 +680,9 @@ class Application(QApplication):
s: The string to evaluate.
"""
try:
- r = eval(s) # pylint: disable=eval-used
+ r = eval(s)
out = repr(r)
- except Exception: # pylint: disable=broad-except
+ except Exception:
out = traceback.format_exc()
qutescheme.pyeval_output = out
tabbed_browser = objreg.get('tabbed-browser', scope='window',
diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py
index 7e33572c2..d82323f8b 100644
--- a/qutebrowser/browser/commands.py
+++ b/qutebrowser/browser/commands.py
@@ -951,8 +951,8 @@ class CommandDispatcher:
@cmdutils.register(instance='command-dispatcher', scope='window')
def view_source(self):
"""Show the source of the current page."""
- # pylint doesn't seem to like pygments...
# pylint: disable=no-member
+ # https://bitbucket.org/logilab/pylint/issue/491/
widget = self._current_widget()
if widget.viewing_source:
raise cmdexc.CommandError("Already viewing source!")
diff --git a/qutebrowser/browser/network/qutescheme.py b/qutebrowser/browser/network/qutescheme.py
index 27d8e144a..9954d87e8 100644
--- a/qutebrowser/browser/network/qutescheme.py
+++ b/qutebrowser/browser/network/qutescheme.py
@@ -19,7 +19,9 @@
#
# pylint complains when using .render() on jinja templates, so we make it shut
# up for this whole module.
-# pylint: disable=maybe-no-member
+
+# pylint: disable=no-member
+# https://bitbucket.org/logilab/pylint/issue/490/
"""Handler functions for different qute:... pages.
diff --git a/qutebrowser/browser/rfc6266.py b/qutebrowser/browser/rfc6266.py
index 5c1420bcd..2fc389fc0 100644
--- a/qutebrowser/browser/rfc6266.py
+++ b/qutebrowser/browser/rfc6266.py
@@ -24,8 +24,7 @@ import urllib.parse
import string
import re
-import pypeg2 as peg # pylint: disable=import-error
-# (fails on win7 in venv...)
+import pypeg2 as peg
from qutebrowser.utils import log, utils
@@ -293,7 +292,9 @@ def normalize_ws(text):
def parse_headers(content_disposition):
"""Build a ContentDisposition from header values."""
- # pylint: disable=maybe-no-member
+ # https://bitbucket.org/logilab/pylint/issue/492/
+ # pylint: disable=no-member
+
# We allow non-ascii here (it will only be parsed inside of qdtext, and
# rejected by the grammar if it appears in other places), although parsing
# it can be ambiguous. Parsing it ensures that a non-ambiguous filename*
diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py
index 230d5b48b..02639a12f 100644
--- a/qutebrowser/browser/webpage.py
+++ b/qutebrowser/browser/webpage.py
@@ -163,7 +163,9 @@ class BrowserPage(QWebPage):
info.domain, info.error))
title = "Error loading page: {}".format(urlstr)
template = jinja.env.get_template('error.html')
- html = template.render( # pylint: disable=maybe-no-member
+ # pylint: disable=no-member
+ # https://bitbucket.org/logilab/pylint/issue/490/
+ html = template.render(
title=title, url=urlstr, error=error_str, icon='')
errpage.content = html.encode('utf-8')
errpage.encoding = 'utf-8'
diff --git a/qutebrowser/config/value.py b/qutebrowser/config/value.py
index e1c03c60e..da4e45b09 100644
--- a/qutebrowser/config/value.py
+++ b/qutebrowser/config/value.py
@@ -79,6 +79,7 @@ class SettingValue:
if val is not None:
return val
else: # pylint: disable=useless-else-on-loop
+ # https://bitbucket.org/logilab/pylint/issue/489/
raise ValueError("No valid config value found!")
def transformed(self):
diff --git a/qutebrowser/keyinput/basekeyparser.py b/qutebrowser/keyinput/basekeyparser.py
index 0e3a3c517..7d6a2b22b 100644
--- a/qutebrowser/keyinput/basekeyparser.py
+++ b/qutebrowser/keyinput/basekeyparser.py
@@ -166,7 +166,7 @@ class BaseKeyParser(QObject):
return self.Match.none
if len(txt) == 1:
- category = unicodedata.category(txt) # pylint: disable=no-member
+ category = unicodedata.category(txt)
is_control_char = (category == 'Cc')
else:
is_control_char = False
diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py
index 09ac7ebd7..1bc7a1b42 100644
--- a/qutebrowser/mainwindow/mainwindow.py
+++ b/qutebrowser/mainwindow/mainwindow.py
@@ -183,7 +183,7 @@ class MainWindow(QWidget):
def _connect_signals(self):
"""Connect all mainwindow signals."""
- # pylint: disable=too-many-locals,too-many-statements
+ # pylint: disable=too-many-statements
key_config = objreg.get('key-config')
status = self._get_object('statusbar')
diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py
index b48d3919c..8e07db23c 100644
--- a/qutebrowser/mainwindow/statusbar/bar.py
+++ b/qutebrowser/mainwindow/statusbar/bar.py
@@ -202,7 +202,6 @@ class StatusBar(QWidget):
Return:
The severity as a string (!)
"""
- # pylint: disable=method-hidden
if self._severity is None:
return ""
else:
@@ -233,7 +232,6 @@ class StatusBar(QWidget):
@pyqtProperty(bool)
def prompt_active(self):
"""Getter for self.prompt_active, so it can be used as Qt property."""
- # pylint: disable=method-hidden
return self._prompt_active
def _set_prompt_active(self, val):
@@ -249,7 +247,6 @@ class StatusBar(QWidget):
@pyqtProperty(bool)
def insert_active(self):
"""Getter for self.insert_active, so it can be used as Qt property."""
- # pylint: disable=method-hidden
return self._insert_active
def _set_insert_active(self, val):
diff --git a/qutebrowser/mainwindow/statusbar/url.py b/qutebrowser/mainwindow/statusbar/url.py
index abc2ab660..db2e3c8f1 100644
--- a/qutebrowser/mainwindow/statusbar/url.py
+++ b/qutebrowser/mainwindow/statusbar/url.py
@@ -90,7 +90,6 @@ class UrlText(textbase.TextBase):
Return:
The urltype as a string (!)
"""
- # pylint: disable=method-hidden
if self._urltype is None:
return ""
else:
diff --git a/qutebrowser/misc/crashdialog.py b/qutebrowser/misc/crashdialog.py
index 6f527ade1..dd20e7a07 100644
--- a/qutebrowser/misc/crashdialog.py
+++ b/qutebrowser/misc/crashdialog.py
@@ -17,8 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see .
-# pylint: disable=broad-except
-
"""The dialog which gets shown when qutebrowser crashes."""
import re
diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py
index 686a453c0..0e954e5d2 100644
--- a/qutebrowser/misc/utilcmds.py
+++ b/qutebrowser/misc/utilcmds.py
@@ -54,7 +54,7 @@ def later(ms: {'type': int}, command, win_id: {'special': 'win_id'}):
functools.partial(commandrunner.run_safely, command))
timer.timeout.connect(timer.deleteLater)
timer.start()
- except: # pylint: disable=bare-except
+ except:
timer.deleteLater()
raise
@@ -85,7 +85,7 @@ def debug_crash(typ: {'type': ('exception', 'segfault')}='exception'):
# From python's Lib/test/crashers/bogus_code_obj.py
co = types.CodeType(0, 0, 0, 0, 0, b'\x04\x71\x00\x00', (), (), (),
'', '', 1, b'')
- exec(co) # pylint: disable=exec-used
+ exec(co)
raise Exception("Segfault failed (wat.)")
else:
raise Exception("Forced crash")
diff --git a/qutebrowser/qutebrowser.py b/qutebrowser/qutebrowser.py
index 73061451e..8a331aa8f 100644
--- a/qutebrowser/qutebrowser.py
+++ b/qutebrowser/qutebrowser.py
@@ -124,7 +124,7 @@ def main():
WARNING: misc/crashdialog.py checks the stacktrace for this function
name, so if this is changed, it should be changed there as well!
"""
- return app.exec_() # pylint: disable=maybe-no-member
+ return app.exec_()
# We set qApp explicitely here to reduce the risk of segfaults while
# quitting.
diff --git a/qutebrowser/test/config/test_config.py b/qutebrowser/test/config/test_config.py
index 06ab02983..029731e2e 100644
--- a/qutebrowser/test/config/test_config.py
+++ b/qutebrowser/test/config/test_config.py
@@ -69,7 +69,6 @@ class ConfigParserTests(unittest.TestCase):
"""Test a transformed option with the old name."""
# WORKAROUND for unknown PyQt bug
# Instance of 'str' has no 'name' member
- # pylint: disable=no-member
self.cp.read_dict({'colors': {'tab.fg.odd': 'pink'}})
self.cfg._from_cp(self.cp)
self.assertEqual(self.cfg.get('colors', 'tabs.fg.odd').name(),
@@ -79,7 +78,6 @@ class ConfigParserTests(unittest.TestCase):
"""Test a transformed section with the new name."""
# WORKAROUND for unknown PyQt bug
# Instance of 'str' has no 'name' member
- # pylint: disable=no-member
self.cp.read_dict({'colors': {'tabs.fg.odd': 'pink'}})
self.cfg._from_cp(self.cp)
self.assertEqual(self.cfg.get('colors', 'tabs.fg.odd').name(),
diff --git a/qutebrowser/test/misc/test_editor.py b/qutebrowser/test/misc/test_editor.py
index ae697a231..31843368c 100644
--- a/qutebrowser/test/misc/test_editor.py
+++ b/qutebrowser/test/misc/test_editor.py
@@ -210,8 +210,6 @@ class ErrorMessageTests(unittest.TestCase):
editor: The ExternalEditor instance to test.
"""
- # pylint: disable=maybe-no-member
-
def setUp(self):
self.editor = editor.ExternalEditor(0)
diff --git a/qutebrowser/test/utils/test_jinja.py b/qutebrowser/test/utils/test_jinja.py
index 147c61ac1..eee703cdf 100644
--- a/qutebrowser/test/utils/test_jinja.py
+++ b/qutebrowser/test/utils/test_jinja.py
@@ -43,7 +43,8 @@ class JinjaTests(unittest.TestCase):
"""Test with a simple template."""
readfile_mock.side_effect = _read_file
template = jinja.env.get_template('test.html')
- data = template.render(var='World') # pylint: disable=maybe-no-member
+ # https://bitbucket.org/logilab/pylint/issue/490/
+ data = template.render(var='World') # pylint: disable=no-member
self.assertEqual(data, "Hello World")
def test_utf8(self, readfile_mock):
@@ -56,7 +57,8 @@ class JinjaTests(unittest.TestCase):
"""
readfile_mock.side_effect = _read_file
template = jinja.env.get_template('test.html')
- data = template.render(var='\u2603') # pylint: disable=maybe-no-member
+ # https://bitbucket.org/logilab/pylint/issue/490/
+ data = template.render(var='\u2603') # pylint: disable=no-member
self.assertEqual(data, "Hello \u2603")
diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py
index 1ab8c2bd5..1cb46840e 100644
--- a/qutebrowser/utils/log.py
+++ b/qutebrowser/utils/log.py
@@ -32,12 +32,10 @@ from PyQt5.QtCore import (QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg,
qInstallMessageHandler)
# Optional imports
try:
- # pylint: disable=import-error
import colorama
except ImportError:
colorama = None
try:
- # pylint: disable=import-error
import colorlog
except ImportError:
colorlog = None
diff --git a/qutebrowser/utils/qtutils.py b/qutebrowser/utils/qtutils.py
index bfe68bf3e..939e1ed81 100644
--- a/qutebrowser/utils/qtutils.py
+++ b/qutebrowser/utils/qtutils.py
@@ -183,7 +183,7 @@ def savefile_open(filename, binary=False, encoding='utf-8'):
new_f = None
try:
ok = f.open(QIODevice.WriteOnly)
- if not ok: # pylint: disable=used-before-assignment
+ if not ok:
raise OSError(f.errorString())
if binary:
new_f = PyQIODevice(f)
@@ -196,8 +196,8 @@ def savefile_open(filename, binary=False, encoding='utf-8'):
finally:
if new_f is not None:
new_f.flush()
- ok = f.commit()
- if not ok:
+ commit_ok = f.commit()
+ if not commit_ok:
raise OSError(f.errorString())
diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py
index 43320e939..6823685d7 100644
--- a/qutebrowser/utils/version.py
+++ b/qutebrowser/utils/version.py
@@ -171,8 +171,6 @@ def _os_info():
Return:
A list of lines with version info.
"""
- # pylint has issues with platform.mac_ver()
- # pylint: disable=unpacking-non-sequence
lines = []
releaseinfo = None
if sys.platform == 'linux':
@@ -181,6 +179,8 @@ def _os_info():
elif sys.platform == 'win32':
osver = ', '.join(platform.win32_ver())
elif sys.platform == 'darwin':
+ # pylint: disable=unpacking-non-sequence
+ # See https://bitbucket.org/logilab/pylint/issue/165/
release, versioninfo, machine = platform.mac_ver()
if all(not e for e in versioninfo):
versioninfo = ''
diff --git a/scripts/hostblock_blame.py b/scripts/hostblock_blame.py
index 9b9e986a9..beb74a3b9 100644
--- a/scripts/hostblock_blame.py
+++ b/scripts/hostblock_blame.py
@@ -18,8 +18,6 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see .
-# pylint: disable=broad-except
-
"""Check by which hostblock list a host was blocked."""
import sys
diff --git a/scripts/run_checks.py b/scripts/run_checks.py
index e2a5d4307..495f35e13 100755
--- a/scripts/run_checks.py
+++ b/scripts/run_checks.py
@@ -18,8 +18,6 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see .
-# pylint: disable=broad-except
-
""" Run different codecheckers over a codebase.
Runs flake8, pylint, pep257, a CRLF/whitespace/conflict-checker and
@@ -81,7 +79,6 @@ def run(name, target=None, print_version=False):
target: The package to check
print_version: Whether to print the checker version.
"""
- # pylint: disable=too-many-branches
args = _get_args(name)
if target is not None:
args.append(target)
@@ -112,7 +109,6 @@ def check_pep257(target, print_version=False):
We use this rather than run() because on some systems (e.g. Windows) no
pep257 binary is available.
"""
- # pylint: disable=assignment-from-no-return,no-member
if print_version:
print(pep257.__version__)
args = _get_args('pep257')
@@ -120,6 +116,7 @@ def check_pep257(target, print_version=False):
if args is not None:
sys.argv += args
try:
+ # pylint: disable=assignment-from-no-return,no-member
if hasattr(pep257, 'run_pep257'):
# newer pep257 versions
status = pep257.run_pep257()
@@ -219,6 +216,8 @@ def check_vcs_conflict(target):
def _get_optional_args(checker):
"""Get a list of arguments based on a comma-separated args config."""
+ # pylint: disable=no-member
+ # https://bitbucket.org/logilab/pylint/issue/487/
try:
return config.get(checker, 'args').split(',')
except configparser.NoOptionError:
@@ -239,6 +238,8 @@ def _get_args(checker):
Return:
A list of commandline arguments.
"""
+ # pylint: disable=no-member
+ # https://bitbucket.org/logilab/pylint/issue/487/
args = []
if checker == 'pylint':
args += _get_flag('disable', 'pylint', 'disable')
@@ -275,6 +276,8 @@ def _get_args(checker):
def _get_checkers(args):
"""Get a dict of checkers we need to execute."""
+ # pylint: disable=no-member
+ # https://bitbucket.org/logilab/pylint/issue/487/
# "Static" checkers
checkers = collections.OrderedDict([
('global', collections.OrderedDict([
@@ -303,6 +306,8 @@ def _get_checkers(args):
def _checker_enabled(args, group, name):
"""Check if a named checker is enabled."""
+ # pylint: disable=no-member
+ # https://bitbucket.org/logilab/pylint/issue/487/
if args.checkers == 'all':
if not args.setup and group == 'setup':
return False
@@ -333,6 +338,8 @@ def _parse_args():
def main():
"""Main entry point."""
+ # pylint: disable=no-member
+ # https://bitbucket.org/logilab/pylint/issue/487/
utils.change_cwd()
read_files = config.read('.run_checks')
if not read_files:
diff --git a/scripts/src2asciidoc.py b/scripts/src2asciidoc.py
index 2fb1213bc..cd489a0aa 100755
--- a/scripts/src2asciidoc.py
+++ b/scripts/src2asciidoc.py
@@ -367,7 +367,7 @@ def _format_block(filename, what, data):
elif not found_end:
raise Exception("Marker '// QUTE_{}_END' not found in "
"'{}'!".format(what, filename))
- except: # pylint: disable=bare-except
+ except:
os.remove(tmpname)
raise
else: