diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 6cdcfe9e3..a03faa07f 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -1228,7 +1228,8 @@ class DownloadManager(QAbstractListModel): def flags(self, _index): """Override flags so items aren't selectable. - The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable.""" + The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable. + """ return Qt.ItemIsEnabled | Qt.ItemNeverHasChildren def rowCount(self, parent=QModelIndex()): diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index d03486570..fbd7b1b22 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -261,7 +261,8 @@ class CommandRunner(QObject): """Run a command and display exceptions in the statusbar. Contrary to run_safely, error messages are queued so this is more - suitable to use while initializing.""" + suitable to use while initializing. + """ try: self.run(text, count) except (cmdexc.CommandMetaError, cmdexc.CommandError) as e: diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py index 400ea2568..3b71a6548 100644 --- a/qutebrowser/completion/models/miscmodels.py +++ b/qutebrowser/completion/models/miscmodels.py @@ -147,7 +147,8 @@ class TabCompletionModel(base.BaseCompletionModel): """A model to complete on open tabs across all windows. - Used for switching the buffer command.""" + Used for switching the buffer command. + """ # https://github.com/The-Compiler/qutebrowser/issues/545 # pylint: disable=abstract-method diff --git a/qutebrowser/completion/models/urlmodel.py b/qutebrowser/completion/models/urlmodel.py index b31ab9809..244bb1395 100644 --- a/qutebrowser/completion/models/urlmodel.py +++ b/qutebrowser/completion/models/urlmodel.py @@ -32,7 +32,8 @@ class UrlCompletionModel(base.BaseCompletionModel): """A model which combines bookmarks, quickmarks and web history URLs. - Used for the `open` command.""" + Used for the `open` command. + """ # https://github.com/The-Compiler/qutebrowser/issues/545 # pylint: disable=abstract-method diff --git a/qutebrowser/misc/crashdialog.py b/qutebrowser/misc/crashdialog.py index 3c4ab03d4..19413a297 100644 --- a/qutebrowser/misc/crashdialog.py +++ b/qutebrowser/misc/crashdialog.py @@ -198,7 +198,8 @@ class _CrashDialog(QDialog): def _init_text(self): """Initialize the main text to be displayed on an exception. - Should be extended by subclasses to set the actual text.""" + Should be extended by subclasses to set the actual text. + """ self._lbl = QLabel(wordWrap=True, openExternalLinks=True, textInteractionFlags=Qt.LinksAccessibleByMouse) self._vbox.addWidget(self._lbl) diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index 969a40368..7507bc59e 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -267,7 +267,8 @@ def remove_inputhook(): """Remove the PyQt input hook. Doing this means we can't use the interactive shell anymore (which we don't - anyways), but we can use pdb instead.""" + anyways), but we can use pdb instead. + """ from PyQt5.QtCore import pyqtRemoveInputHook pyqtRemoveInputHook() diff --git a/scripts/dev/update_3rdparty.py b/scripts/dev/update_3rdparty.py index f53135a99..16e604c84 100755 --- a/scripts/dev/update_3rdparty.py +++ b/scripts/dev/update_3rdparty.py @@ -31,7 +31,8 @@ import os def get_latest_pdfjs_url(): """Get the URL of the latest pdf.js prebuilt package. - Returns a (version, url)-tuple.""" + Returns a (version, url)-tuple. + """ github_api = 'https://api.github.com' endpoint = 'repos/mozilla/pdf.js/releases/latest' request_url = '{}/{}'.format(github_api, endpoint) diff --git a/setup.cfg b/setup.cfg index 606640d42..c6df27380 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,6 +31,10 @@ exclude = .venv,.hypothesis,.git,__pycache__,resources.py # (PEP257 got changed, but let's stick to the old standard) # D402: First line should not be function's signature (false-positives) # FI10 - FI15: __future__ import missing +# H201: bare except +# H238: Use new-stule classes +# H301: one import per line +# H306: imports not in alphabetical order ignore = E128,E226,E265,E501,E402,E266, F401, @@ -38,7 +42,8 @@ ignore = L101,L102,L103,L201,L202,L203,L204,L207,L302, P101,P102,P103, D102,D103,D104,D105,D209,D211,D402, - FI10,FI11,FI12,FI13,FI14,FI15 + FI10,FI11,FI12,FI13,FI14,FI15, + H201,H238,H301,H306 max-complexity = 12 putty-ignore = /# pylint: disable=invalid-name/ : +N801,N806 diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index a099a1887..2ff052937 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -326,7 +326,8 @@ def compare_session(quteproc, expected): def no_crash(): """Don't do anything. - This is actually a NOP as a crash is already checked in the log.""" + This is actually a NOP as a crash is already checked in the log. + """ pass diff --git a/tests/unit/mainwindow/statusbar/test_percentage.py b/tests/unit/mainwindow/statusbar/test_percentage.py index bba465161..c40603188 100644 --- a/tests/unit/mainwindow/statusbar/test_percentage.py +++ b/tests/unit/mainwindow/statusbar/test_percentage.py @@ -46,8 +46,7 @@ def percentage(qtbot): (5, '[ 5%]'), ]) def test_percentage_text(percentage, y, expected): - """ - Test text displayed by the widget based on the y position of a page. + """Test text displayed by the widget based on the y position of a page. Args: y: y position of the page as an int in the range [0, 100]. diff --git a/tests/unit/misc/test_split.py b/tests/unit/misc/test_split.py index 272b281ea..7b3c8015a 100644 --- a/tests/unit/misc/test_split.py +++ b/tests/unit/misc/test_split.py @@ -104,8 +104,7 @@ foo\ bar/foo bar/foo\ bar/ def _parse_split_test_data_str(): - """ - Parse the test data set into a namedtuple to use in tests. + """Parse the test data set into a namedtuple to use in tests. Returns: A list of namedtuples with str attributes: input, keep, no_keep diff --git a/tox.ini b/tox.ini index c66fc9af5..0071cb34f 100644 --- a/tox.ini +++ b/tox.ini @@ -161,6 +161,7 @@ deps = flake8-tuple==0.2.9 flake8-tidy-imports==1.0.0 flake8-future-import==0.3.0 + hacking==0.10.2 pep257==0.7.0 # still needed by flake8-docstrings but ignored pydocstyle==1.0.0 commands =